]> arthur.barton.de Git - bup.git/commitdiff
git/client/server: remove rev_list() count support
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 28 Jan 2020 23:21:01 +0000 (00:21 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 1 Mar 2020 22:54:07 +0000 (16:54 -0600)
This is obviously not used, as passing count!=None would
crash the client method (client.py doesn't import Integral).
Rather than fixing that, just remove support for it entirely.

While at it, also clean up a duplicate rev_list_invocation()
call in the server.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
cmd/server-cmd.py
lib/bup/client.py
lib/bup/git.py

index acd70077d199699635b90da66ef52319a392c197..2c8cc051a9febdf583e967e5ee378e5176a9baea 100755 (executable)
@@ -214,15 +214,15 @@ def rev_list(conn, _):
     count = conn.readline()
     if not count:
         raise Exception('Unexpected EOF while reading rev-list count')
-    count = None if count == b'\n' else int(count)
+    assert count == b'\n'
+    count = None
     fmt = conn.readline()
     if not fmt:
         raise Exception('Unexpected EOF while reading rev-list format')
     fmt = None if fmt == b'\n' else fmt[:-1]
     refs = tuple(x[:-1] for x in lines_until_sentinel(conn, b'\n', Exception))
-    args = git.rev_list_invocation(refs, count=count, format=fmt)
-    p = subprocess.Popen(git.rev_list_invocation(refs, count=count, format=fmt),
-                         env=git._gitenv(git.repodir),
+    args = git.rev_list_invocation(refs, format=fmt)
+    p = subprocess.Popen(args, env=git._gitenv(git.repodir),
                          stdout=subprocess.PIPE)
     while True:
         out = p.stdout.read(64 * 1024)
index 927e05321ab1e7e77be6d7040723e09605f8e39e..f8f5807d87cfd6bf5ab270b53536acd237c87ab3 100644 (file)
@@ -407,7 +407,7 @@ class Client:
             raise not_ok
         self._not_busy()
 
-    def rev_list(self, refs, count=None, parse=None, format=None):
+    def rev_list(self, refs, parse=None, format=None):
         """See git.rev_list for the general semantics, but note that with the
         current interface, the parse function must be able to handle
         (consume) any blank lines produced by the format because the
@@ -416,7 +416,6 @@ class Client:
 
         """
         self._require_command(b'rev-list')
-        assert (count is None) or (isinstance(count, Integral))
         if format:
             assert b'\n' not in format
             assert parse
@@ -427,8 +426,6 @@ class Client:
         self._busy = b'rev-list'
         conn = self.conn
         conn.write(b'rev-list\n')
-        if count is not None:
-            conn.write(b'%d' % count)
         conn.write(b'\n')
         if format:
             conn.write(format)
index f364227ea56a93fd880eafc7265cdb907a911d3b..d1515e3f3f95823f77714e3d396810aa9a43e1e8 100644 (file)
@@ -973,16 +973,12 @@ def read_ref(refname, repo_dir = None):
         return None
 
 
-def rev_list_invocation(ref_or_refs, count=None, format=None):
+def rev_list_invocation(ref_or_refs, format=None):
     if isinstance(ref_or_refs, bytes):
         refs = (ref_or_refs,)
     else:
         refs = ref_or_refs
     argv = [b'git', b'rev-list']
-    if isinstance(count, Integral):
-        argv.extend([b'-n', b'%d' % count])
-    elif count:
-        raise ValueError('unexpected count argument %r' % count)
 
     if format:
         argv.append(b'--pretty=format:' + format)
@@ -993,7 +989,7 @@ def rev_list_invocation(ref_or_refs, count=None, format=None):
     return argv
 
 
-def rev_list(ref_or_refs, count=None, parse=None, format=None, repo_dir=None):
+def rev_list(ref_or_refs, parse=None, format=None, repo_dir=None):
     """Yield information about commits as per "git rev-list".  If a format
     is not provided, yield one hex hash at a time.  If a format is
     provided, pass it to rev-list and call parse(git_stdout) for each
@@ -1003,7 +999,7 @@ def rev_list(ref_or_refs, count=None, parse=None, format=None, repo_dir=None):
 
     """
     assert bool(parse) == bool(format)
-    p = subprocess.Popen(rev_list_invocation(ref_or_refs, count=count,
+    p = subprocess.Popen(rev_list_invocation(ref_or_refs,
                                              format=format),
                          env=_gitenv(repo_dir),
                          stdout = subprocess.PIPE)