[Python-apps-team] Bug#921732: NMU diff for hg-git 0.8.12-1.1

Julien Cristau jcristau at debian.org
Wed Mar 13 14:55:37 GMT 2019


Hi,

I'll be uploading a NMU for hg-git in a minute.  debdiff below, also
pushed to
https://salsa.debian.org/python-team/applications/hg-git/merge_requests/1

Cheers,
Julien


diff -Nru hg-git-0.8.12/debian/changelog hg-git-0.8.12/debian/changelog
--- hg-git-0.8.12/debian/changelog	2019-01-10 15:26:54.000000000 +0100
+++ hg-git-0.8.12/debian/changelog	2019-03-13 15:43:48.000000000 +0100
@@ -1,3 +1,10 @@
+hg-git (0.8.12-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix for compatibility with mercurial 4.9 (closes: #921732).
+
+ -- Julien Cristau <jcristau at debian.org>  Wed, 13 Mar 2019 15:43:48 +0100
+
 hg-git (0.8.12-1) unstable; urgency=medium
 
   * Team upload
diff -Nru hg-git-0.8.12/debian/patches/fix-test-capitalisation.patch hg-git-0.8.12/debian/patches/fix-test-capitalisation.patch
--- hg-git-0.8.12/debian/patches/fix-test-capitalisation.patch	2019-01-10 13:57:00.000000000 +0100
+++ hg-git-0.8.12/debian/patches/fix-test-capitalisation.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-Description: Fix capitalisation mismatches in tests
-Author: Daniel Watkins <oddbloke at ubuntu.com>
-Forwarded: no
-Last-Update: 2018-06-07
-
---- a/tests/test-git-clone.t
-+++ b/tests/test-git-clone.t
-@@ -51,8 +51,8 @@
-   abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
-   [255]
-   $ hg clone 'git+ssh://fakehost|rm${IFS}nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
--  ssh: * fakehost%7crm%24%7bifs%7dnonexistent* (glob)
-+  ssh: * fakehost%7Crm%24%7BIFS%7Dnonexistent* (glob)
-   abort: git remote error: The remote server unexpectedly closed the connection.
-   $ hg clone 'git+ssh://fakehost%7Crm${IFS}nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
--  ssh: * fakehost%7crm%24%7bifs%7dnonexistent* (glob)
-+  ssh: * fakehost%7Crm%24%7BIFS%7Dnonexistent* (glob)
-   abort: git remote error: The remote server unexpectedly closed the connection.
---- a/tests/test-pull.t
-+++ b/tests/test-pull.t
-@@ -366,8 +366,8 @@
-   abort: potentially unsafe hostname: '-oProxyCommand=rm nonexistent'
-   [255]
-   $ hg pull 'git+ssh://fakehost|shellcommand/path' 2>&1 >/dev/null | grep -v ^devel-warn:
--  ssh: * fakehost%7cshellcommand* (glob)
-+  ssh: * fakehost%7Cshellcommand* (glob)
-   abort: git remote error: The remote server unexpectedly closed the connection.
-   $ hg pull 'git+ssh://fakehost%7Cshellcommand/path' 2>&1 >/dev/null | grep -v ^devel-warn:
--  ssh: * fakehost%7cshellcommand* (glob)
-+  ssh: * fakehost%7Cshellcommand* (glob)
-   abort: git remote error: The remote server unexpectedly closed the connection.
---- a/tests/test-push.t
-+++ b/tests/test-push.t
-@@ -211,8 +211,8 @@
-   abort: potentially unsafe hostname: '-oProxyCommand=rm nonexistent'
-   [255]
-   $ hg push 'git+ssh://fakehost|rm%20nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
--  ssh: * fakehost%7crm%20nonexistent* (glob)
-+  ssh: * fakehost%7Crm%20nonexistent* (glob)
-   abort: git remote error: The remote server unexpectedly closed the connection.
-   $ hg push 'git+ssh://fakehost%7Crm%20nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
--  ssh: * fakehost%7crm%20nonexistent* (glob)
-+  ssh: * fakehost%7Crm%20nonexistent* (glob)
-   abort: git remote error: The remote server unexpectedly closed the connection.
diff -Nru hg-git-0.8.12/debian/patches/hg49-compat.patch hg-git-0.8.12/debian/patches/hg49-compat.patch
--- hg-git-0.8.12/debian/patches/hg49-compat.patch	1970-01-01 01:00:00.000000000 +0100
+++ hg-git-0.8.12/debian/patches/hg49-compat.patch	2019-03-13 15:34:02.000000000 +0100
@@ -0,0 +1,264 @@
+diff --git a/hggit/compat.py b/hggit/compat.py
+--- a/hggit/compat.py
++++ b/hggit/compat.py
+@@ -4,6 +4,7 @@ from mercurial import (
+     phases,
+     templatekw,
+     url,
++    ui as hgui,
+     util as hgutil,
+ )
+ 
+@@ -204,3 +205,15 @@ class templatekeyword(object):
+             templatekw.keywords.update({name: func})
+             return func
+         return decorate
++
++if hgutil.safehasattr(hgui.ui, 'makeprogress'):
++    def progress(ui, topic, pos, item="", unit="", total=None):
++        progress = ui.makeprogress(topic, unit, total)
++        if pos is not None:
++            progress.update(pos, item=item)
++        else:
++            progress.complete()
++else:
++    # <= hg-48
++    def progress(ui, topic, pos, item="", unit="", total=None):
++        ui.progress(topic, pos, item="", unit="", total=None)
+diff --git a/hggit/git_handler.py b/hggit/git_handler.py
+--- a/hggit/git_handler.py
++++ b/hggit/git_handler.py
+@@ -93,13 +93,13 @@ class GitProgress(object):
+                 self.lasttopic = topic
+ 
+                 pos, total = map(int, m.group(1, 2))
+-                self.ui.progress(topic, pos, total=total)
++                compat.progress(self.ui, topic, pos, total=total)
+             else:
+                 self.flush(msg)
+ 
+     def flush(self, msg=None):
+         if self.lasttopic:
+-            self.ui.progress(self.lasttopic, None)
++            compat.progress(self.ui, self.lasttopic, None)
+         self.lasttopic = None
+         if msg:
+             self.ui.note(msg + '\n')
+@@ -487,7 +487,7 @@ class GitHandler(object):
+         for ctx in to_export:
+             item = hex(ctx.node())
+             pos += 1
+-            repo.ui.progress(topic, pos, item, unit, todo_total)
++            compat.progress(repo.ui, topic, pos, item, unit, todo_total)
+             if ctx.extra().get('hg-git', None) != 'octopus':
+                 export.append(ctx)
+ 
+@@ -521,12 +521,12 @@ class GitHandler(object):
+         mapsavefreq = compat.config(self.ui, 'int', 'hggit',
+                                     'mapsavefrequency')
+         for i, ctx in enumerate(export):
+-            self.ui.progress('exporting', i, total=total)
++            compat.progress(self.ui, 'exporting', i, total=total)
+             self.export_hg_commit(ctx.node(), exporter)
+             if mapsavefreq and i % mapsavefreq == 0:
+                 self.ui.debug(_("saving mapfile\n"))
+                 self.save_map(self.map_file)
+-        self.ui.progress('exporting', None, total=total)
++        compat.progress(self.ui, 'exporting', None, total=total)
+ 
+     def set_commiter_from_author(self, commit):
+         commit.committer = commit.author
+@@ -813,13 +813,13 @@ class GitHandler(object):
+         mapsavefreq = compat.config(self.ui, 'int', 'hggit',
+                                     'mapsavefrequency')
+         for i, csha in enumerate(commits):
+-            self.ui.progress('importing', i, total=total, unit='commits')
++            compat.progress(self.ui, 'importing', i, total=total, unit='commits')
+             commit = commit_cache[csha]
+             self.import_git_commit(commit)
+             if mapsavefreq and i % mapsavefreq == 0:
+                 self.ui.debug(_("saving mapfile\n"))
+                 self.save_map(self.map_file)
+-        self.ui.progress('importing', None, total=total, unit='commits')
++        compat.progress(self.ui, 'importing', None, total=total, unit='commits')
+ 
+         # TODO if the tags cache is used, remove any dangling tag references
+         return total
+diff --git a/hggit/gitrepo.py b/hggit/gitrepo.py
+--- a/hggit/gitrepo.py
++++ b/hggit/gitrepo.py
+@@ -12,7 +12,7 @@ except ImportError:
+     from mercurial.peer import peerrepository
+ 
+ 
+-class gitrepo(peerrepository):
++class basegitrepo(peerrepository):
+     def __init__(self, ui, path, create, intents=None, **kwargs):
+         if create:  # pragma: no cover
+             raise error.Abort('Cannot create a git repository.')
+@@ -96,9 +96,51 @@ class gitrepo(peerrepository):
+         def unbundle(self):
+             raise NotImplementedError
+ 
+-    def commandexecutor(self):
+-        from mercurial.wireprotov1peer import peerexecutor
+-        return peerexecutor(self)
++try:
++    from mercurial.wireprotov1peer import (
++        batchable,
++        future,
++        peerexecutor,
++    )
++except ImportError:
++    # compat with <= hg-4.8
++    gitrepo = basegitrepo
++else:
++    class gitrepo(basegitrepo):
++
++        @batchable
++        def lookup(self, key):
++            f = future()
++            yield {}, f
++            yield super(gitrepo, self).lookup(key)
++
++        @batchable
++        def heads(self):
++            f = future()
++            yield {}, f
++            yield super(gitrepo, self).heads()
++
++        @batchable
++        def listkeys(self, namespace):
++            f = future()
++            yield {}, f
++            yield super(gitrepo, self).listkeys(namespace)
++
++        @batchable
++        def pushkey(self, namespace, key, old, new):
++            f = future()
++            yield {}, f
++            yield super(gitrepo, self).pushkey(key, old, new)
++
++        def commandexecutor(self):
++            return peerexecutor(self)
++
++        def _submitbatch(self, req):
++            for op, argsdict in req:
++                yield None
++
++        def _submitone(self, op, args):
++            return None
+ 
+ instance = gitrepo
+ 
+diff --git a/hggit/overlay.py b/hggit/overlay.py
+--- a/hggit/overlay.py
++++ b/hggit/overlay.py
+@@ -467,6 +467,8 @@ class overlayrepo(object):
+                                      self.handler.repo._constructmanifest())
+ 
+     def __getitem__(self, n):
++        if isinstance(n, int):
++            n = self.changelog.node(n)
+         if n not in self.revmap:
+             return self.handler.repo[n]
+         return overlaychangectx(self, n)
+@@ -532,3 +534,7 @@ class overlayrepo(object):
+             elif ref.startswith('refs/tags/'):
+                 tagname = ref[10:]
+                 self.tagmap.setdefault(bin(refs[ref]), []).append(tagname)
++
++    def narrowmatch(self, *args, **kwargs):
++        return self.handler.repo.narrowmatch(*args, **kwargs)
++
+diff --git a/hggit/verify.py b/hggit/verify.py
+--- a/hggit/verify.py
++++ b/hggit/verify.py
+@@ -6,6 +6,7 @@
+ # of the GNU General Public License, incorporated herein by reference.
+ 
+ import stat
++import compat
+ 
+ from mercurial import error
+ from mercurial.i18n import _
+@@ -13,7 +14,6 @@ from mercurial.i18n import _
+ from dulwich import diff_tree
+ from dulwich.objects import Commit, S_IFGITLINK
+ 
+-
+ def verify(ui, repo, hgctx):
+     '''verify that a Mercurial rev matches the corresponding Git rev
+ 
+@@ -62,7 +62,7 @@ def verify(ui, repo, hgctx):
+         if (gitfile.mode == S_IFGITLINK or gitfile.path == '.hgsubstate' or
+             gitfile.path == '.hgsub'):
+             continue
+-        ui.progress('verify', i, total=len(hgfiles))
++        compat.progress(ui, 'verify', i, total=len(hgfiles))
+         i += 1
+         gitfiles.add(gitfile.path)
+ 
+@@ -82,7 +82,7 @@ def verify(ui, repo, hgctx):
+             ui.write(_('difference in: %s\n') % gitfile.path)
+             failed = True
+ 
+-    ui.progress('verify', None, total=len(hgfiles))
++    compat.progress(ui, 'verify', None, total=len(hgfiles))
+ 
+     if hgfiles != gitfiles:
+         failed = True
+diff --git a/tests/test-git-clone.t b/tests/test-git-clone.t
+--- a/tests/test-git-clone.t
++++ b/tests/test-git-clone.t
+@@ -51,8 +51,8 @@ test for ssh vulnerability
+   abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
+   [255]
+   $ hg clone 'git+ssh://fakehost|rm${IFS}nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
+-  ssh: * fakehost%7crm%24%7bifs%7dnonexistent* (glob)
++  ssh: * fakehost%7?rm%24%7????%7?nonexistent* (glob)
+   abort: git remote error: The remote server unexpectedly closed the connection.
+   $ hg clone 'git+ssh://fakehost%7Crm${IFS}nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
+-  ssh: * fakehost%7crm%24%7bifs%7dnonexistent* (glob)
++  ssh: * fakehost%7?rm%24%7????%7?nonexistent* (glob)
+   abort: git remote error: The remote server unexpectedly closed the connection.
+diff --git a/tests/test-help.t b/tests/test-help.t
+--- a/tests/test-help.t
++++ b/tests/test-help.t
+@@ -4,6 +4,7 @@ Load commonly used test logic
+   $ . "$TESTDIR/testutil"
+ 
+   $ hg help | grep 'git' | sed 's/  */ /g'
++   git-cleanup clean up Git commit map after history editing (?)
+    hggit push and pull from a Git server
+    git Working with Git Repositories
+ 
+diff --git a/tests/test-pull.t b/tests/test-pull.t
+--- a/tests/test-pull.t
++++ b/tests/test-pull.t
+@@ -366,8 +366,8 @@ test for ssh vulnerability
+   abort: potentially unsafe hostname: '-oProxyCommand=rm nonexistent'
+   [255]
+   $ hg pull 'git+ssh://fakehost|shellcommand/path' 2>&1 >/dev/null | grep -v ^devel-warn:
+-  ssh: * fakehost%7cshellcommand* (glob)
++  ssh: * fakehost%7?shellcommand* (glob)
+   abort: git remote error: The remote server unexpectedly closed the connection.
+   $ hg pull 'git+ssh://fakehost%7Cshellcommand/path' 2>&1 >/dev/null | grep -v ^devel-warn:
+-  ssh: * fakehost%7cshellcommand* (glob)
++  ssh: * fakehost%7?shellcommand* (glob)
+   abort: git remote error: The remote server unexpectedly closed the connection.
+diff --git a/tests/test-push.t b/tests/test-push.t
+--- a/tests/test-push.t
++++ b/tests/test-push.t
+@@ -211,8 +211,8 @@ test for ssh vulnerability
+   abort: potentially unsafe hostname: '-oProxyCommand=rm nonexistent'
+   [255]
+   $ hg push 'git+ssh://fakehost|rm%20nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
+-  ssh: * fakehost%7crm%20nonexistent* (glob)
++  ssh: * fakehost%7?rm%20nonexistent* (glob)
+   abort: git remote error: The remote server unexpectedly closed the connection.
+-  $ hg push 'git+ssh://fakehost%7Crm%20nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
+-  ssh: * fakehost%7crm%20nonexistent* (glob)
++  $ hg push 'git+ssh://fakehost%7?rm%20nonexistent/path' 2>&1 >/dev/null | grep -v ^devel-warn:
++  ssh: * fakehost%* (glob)
+   abort: git remote error: The remote server unexpectedly closed the connection.
diff -Nru hg-git-0.8.12/debian/patches/series hg-git-0.8.12/debian/patches/series
--- hg-git-0.8.12/debian/patches/series	2019-01-10 11:42:00.000000000 +0100
+++ hg-git-0.8.12/debian/patches/series	2019-03-13 15:38:02.000000000 +0100
@@ -1,4 +1,4 @@
-fix-test-capitalisation.patch
 ae6b1ba7482963bc9de51f299891e99005794e4e.patch
 143b7511eadbea7507d847c805241a6db290ffe7.patch
 8d00fde45adbc6c3c0ccab8e362b5f5c36c171e6.patch
+hg49-compat.patch



More information about the Python-apps-team mailing list