changeset 6213:5c5e45766224

imerge: Fix unbound name error and add a test case
author Joel Rosdahl <joel@rosdahl.net>
date Thu, 06 Mar 2008 22:23:41 +0100
parents e75aab656f46
children 0f76c7dc8484
files hgext/imerge.py tests/test-imerge tests/test-imerge.out
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/imerge.py	Thu Mar 06 22:23:41 2008 +0100
+++ b/hgext/imerge.py	Thu Mar 06 22:23:41 2008 +0100
@@ -8,7 +8,7 @@
 from mercurial.i18n import _
 from mercurial.node import hex, short
 from mercurial import commands, cmdutil, dispatch, fancyopts
-from mercurial import hg, filemerge, util
+from mercurial import hg, filemerge, util, revlog
 import os, tarfile
 
 class InvalidStateFileException(Exception): pass
@@ -78,8 +78,8 @@
 
         try:
             parents = [self.repo.changectx(n) for n in status[:2]]
-        except LookupError:
-            raise util.Abort('merge parent %s not in repository' % short(p))
+        except revlog.LookupError, e:
+            raise util.Abort('merge parent %s not in repository' % e.name)
 
         status = status[2:]
         conflicts = int(status.pop(0)) * 3
--- a/tests/test-imerge	Thu Mar 06 22:23:41 2008 +0100
+++ b/tests/test-imerge	Thu Mar 06 22:23:41 2008 +0100
@@ -61,4 +61,10 @@
 echo % nothing to merge
 hg imerge
 
+cd ..
+hg -q clone -r 0 base clone
+cd clone
+echo % load unknown parent
+hg imerge load ../savedmerge
+
 exit 0
--- a/tests/test-imerge.out	Thu Mar 06 22:23:41 2008 +0100
+++ b/tests/test-imerge.out	Thu Mar 06 22:23:41 2008 +0100
@@ -46,3 +46,5 @@
 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
 % nothing to merge
 abort: there is nothing to merge - use "hg update" instead
+% load unknown parent
+abort: merge parent e6da4671640124fe5d3d70d2f54441d6cd76ae35 not in repository