changeset 23926:fea3416f2440 stable

convert: handle LookupError in mercurial_source.lookuprev() This is in line with the documentation on the base class method, and is related to issue4496 (but doesn't fix the reporter's problem of not mangling other data that matches a revision pattern). Now instead of aborting when there is an ambiguous source rev, it simply won't update the commit comment. A warning message might be nice, but a None return masks whether the problem was no matching revision, or more than one. The only other caller of this is the logic that converts tags, but those are never ambiguous since they are always 40 characters. A test isn't feasible because there simply aren't enough commits in the test suite repos to have an ambiguous identifier that is at least 6 characters long, and it would be too easy for the ambiguity to disappear when unrelated changes are made. Instead, I simply ran 'hg --traceback log -r c' on the hg repo, and handled the error it threw.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 18 Jan 2015 22:21:53 -0500
parents e563e0cfe08c
children ca6cfc2f8197
files hgext/convert/hg.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/hg.py	Sun Jan 18 22:24:14 2015 -0800
+++ b/hgext/convert/hg.py	Sun Jan 18 22:21:53 2015 -0500
@@ -467,7 +467,7 @@
     def lookuprev(self, rev):
         try:
             return hex(self.repo.lookup(rev))
-        except error.RepoError:
+        except (error.RepoError, error.LookupError):
             return None
 
     def getbookmarks(self):