[PATCH stable] convert: fix a test failure due to git change

Ross Lagerwall rosslagerwall at gmail.com
Mon Jul 30 12:21:23 CDT 2012


# HG changeset patch
# User Ross Lagerwall <rosslagerwall at gmail.com>
# Date 1343668628 -7200
# Branch stable
# Node ID d41a9f90864a0524978eb2654d53af81afb5e87f
# Parent  3ccb49ed1cc13cf71cd780e998f200ed974ec271
convert: fix a test failure due to git change

Since git v1.7.8.2-327-g926f1dd, git does not return non-zero when
"git ls-remote --tags ..." is run and the repository is damaged.
This causes the damaged repository test in test-convert-git.t to
unexpectedly succeed.

Fix this by aborting if git outputs any lines beginning with "error:".

diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -146,12 +146,14 @@
     def gettags(self):
         tags = {}
         alltags = {}
-        fh = self.gitopen('git ls-remote --tags "%s"' % self.path)
+        fh = self.gitopen('git ls-remote --tags "%s" 2>&1' % self.path)
         prefix = 'refs/tags/'
 
         # Build complete list of tags, both annotated and bare ones
         for line in fh:
             line = line.strip()
+            if line.startswith("error:"):
+                raise util.Abort(_('cannot read tags from %s') % self.path)
             node, tag = line.split(None, 1)
             if not tag.startswith(prefix):
                 continue


More information about the Mercurial-devel mailing list