Commits

Brendan Cully committed d123b59

Progress applied upstream

  • Participants
  • Parent commits 7abcadc

Comments (0)

Files changed (3)

+# HG changeset patch
+# Parent 06a8b2e08cc42c0b16735028fde78fcee13a12cb
+Unbreak outgoing to non-git repos with hg pre-1.9
+
+diff --git a/hggit/__init__.py b/hggit/__init__.py
+--- a/hggit/__init__.py
++++ b/hggit/__init__.py
+@@ -129,13 +129,13 @@
+     if getattr(discovery, 'findcommonoutgoing', None):
+         kwname = 'onlyheads'
+     def findoutgoing(orig, local, remote, *args, **kwargs):
+-        kw = {}
+-        kw.update(kwargs)
+-        for val, k in zip(args, ('base', kwname, 'force')):
+-            kw[k] = val
+         if isinstance(remote, gitrepo.gitrepo):
+             # clean up this cruft when we're 1.7-only, remoteheads and
+             # the return value change happened between 1.6 and 1.7.
++            kw = {}
++            kw.update(kwargs)
++            for val, k in zip(args, ('base', kwname, 'force')):
++                kw[k] = val
+             git = GitHandler(local, local.ui)
+             base, heads = git.get_refs(remote.path)
+             newkw = {'base': base, kwname: heads}
+@@ -146,7 +146,8 @@
+                 return [x[0] for x in r]
+             if kwname == 'onlyheads':
+                 del kw['base']
+-        return orig(local, remote, **kw)
++            return orig(local, remote, **kw)
++        return orig(local, remote, *args, **kwargs)
+     if getattr(discovery, 'findoutgoing', None):
+         extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
+     else:

progress

-# HG changeset patch
-# Parent d89d4e93bc46e2af91564e06fbdd4ebb76bab816
-Convert dulwich progress into mercurial ui.progress
-
-Breaks most tests cosmetically, but for the better.
-
-diff --git a/hggit/git_handler.py b/hggit/git_handler.py
---- a/hggit/git_handler.py
-+++ b/hggit/git_handler.py
-@@ -22,6 +22,46 @@
- import util
- from overlay import overlayrepo
- 
-+class GitProgress(object):
-+    """convert git server progress strings into mercurial progress"""
-+    def __init__(self, ui):
-+        self.ui = ui
-+
-+        self.lasttopic = None
-+        self.msgbuf = ''
-+
-+    def progress(self, msg):
-+        # 'Counting objects: 33640, done.\n'
-+        # 'Compressing objects:   0% (1/9955)   \r
-+        msgs = re.split('[\r\n]', self.msgbuf + msg)
-+        self.msgbuf = msgs.pop()
-+
-+        for msg in msgs:
-+            td = msg.split(':', 1)
-+            data = td.pop()
-+            if not td:
-+                self.flush(data)
-+                continue
-+            topic = td[0]
-+
-+            m = re.search('\((\d+)/(\d+)\)', data)
-+            if m:
-+                if self.lasttopic and self.lasttopic != topic:
-+                    self.flush()
-+                self.lasttopic = topic
-+
-+                pos, total = map(int, m.group(1, 2))
-+                self.ui.progress(topic, pos, total=total)
-+            else:
-+                self.flush(msg)
-+
-+    def flush(self, msg=None):
-+        if self.lasttopic:
-+            self.ui.progress(self.lasttopic, None)
-+        self.lasttopic = None
-+        if msg:
-+            self.ui.note(msg + '\n')
-+
- class GitHandler(object):
-     mapfile = 'git-mapfile'
-     tagsfile = 'git-tags'
-@@ -751,8 +791,11 @@
-         f, commit = self.git.object_store.add_pack()
-         try:
-             try:
--                return client.fetch_pack(path, determine_wants, graphwalker,
--                                         f.write, self.ui.status)
-+                progress = GitProgress(self.ui)
-+                ret = client.fetch_pack(path, determine_wants, graphwalker,
-+                                        f.write, progress.progress)
-+                progress.flush()
-+                return ret
-             except (HangupException, GitProtocolError), e:
-                 raise hgutil.Abort(_("git remote error: ") + str(e))
-         finally:
-progress
+outgoing-1.9
 new-discovery