changeset 5110:420e1166a876

Merge with crew
author Brendan Cully <brendan@kublai.com>
date Sat, 04 Aug 2007 09:33:10 -0700
parents 86327d13d916 (current diff) 0f594cc36aed (diff)
children 12930b97a729
files hgext/imerge.py tests/test-copy-move-merge
diffstat 5 files changed, 71 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/imerge.py	Fri Aug 03 18:05:20 2007 -0700
+++ b/hgext/imerge.py	Sat Aug 04 09:33:10 2007 -0700
@@ -44,7 +44,8 @@
         if self.im.repo.dirstate.parents()[0] != p1.node():
             hg.clean(self.im.repo, p1.node())
         self.im.start(p2.node())
-        tf.extractall(self.im.repo.root)
+        for tarinfo in tf:
+            tf.extract(tarinfo, self.im.repo.root)
         self.im.load()
 
 class Imerge(object):
@@ -91,16 +92,18 @@
 
         if not os.path.isdir(self.path):
             os.mkdir(self.path)
-        fd = self.opener('status', 'wb')
+        statusfile = self.opener('status', 'wb')
 
         out = [hex(n.node()) for n in self.wctx.parents()]
         out.append(str(len(self.conflicts)))
-        for f in sorted(self.conflicts):
-            out.append(f)
-            out.extend(self.conflicts[f])
+        conflicts = self.conflicts.items()
+        conflicts.sort()
+        for fw, fd_fo in conflicts:
+            out.append(fw)
+            out.extend(fd_fo)
         out.extend(self.resolved)
 
-        fd.write('\0'.join(out))
+        statusfile.write('\0'.join(out))
 
     def remaining(self):
         return [f for f in self.conflicts if f not in self.resolved]
@@ -163,7 +166,8 @@
             if fn not in self.conflicts:
                 raise util.Abort('%s is not in the merge set' % fn)
             resolved[fn] = True
-        self.resolved = sorted(resolved)
+        self.resolved = resolved.keys()
+        self.resolved.sort()
         self.save()
         return 0
 
@@ -173,7 +177,8 @@
             if fn not in resolved:
                 raise util.Abort('%s is not resolved' % fn)
             del resolved[fn]
-        self.resolved = sorted(resolved)
+        self.resolved = resolved.keys()
+        self.resolved.sort()
         self.save()
         return 0
 
@@ -263,7 +268,8 @@
     if not cmd:
         raise cmdutil.UnknownCommand('imerge ' + c)
     if len(cmd) > 1:
-        raise cmdutil.AmbiguousCommand('imerge ' + c, sorted(cmd))
+        cmd.sort()
+        raise cmdutil.AmbiguousCommand('imerge ' + c, cmd)
     cmd = cmd[0]
 
     func = subcmdtable[cmd]
--- a/mercurial/merge.py	Fri Aug 03 18:05:20 2007 -0700
+++ b/mercurial/merge.py	Sat Aug 04 09:33:10 2007 -0700
@@ -415,10 +415,10 @@
                     updated += 1
                 else:
                     merged += 1
-            if f != fd and move:
+            util.set_exec(repo.wjoin(fd), "x" in flags)
+            if f != fd and move and util.lexists(repo.wjoin(f)):
                 repo.ui.debug(_("removing %s\n") % f)
                 os.unlink(repo.wjoin(f))
-            util.set_exec(repo.wjoin(fd), "x" in flags)
         elif m == "g": # get
             flags = a[2]
             repo.ui.note(_("getting %s\n") % f)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-copy-move-merge	Sat Aug 04 09:33:10 2007 -0700
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+mkdir t
+cd t
+hg init
+
+echo 1 > a
+hg ci -qAm "first" -d "1000000 0"
+
+hg cp a b
+hg mv a c
+echo 2 >> b
+echo 2 >> c
+
+hg ci -qAm "second" -d "1000000 0"
+
+hg co -C 0
+
+echo 0 > a
+echo 1 >> a
+
+hg ci -qAm "other" -d "1000000 0"
+
+hg merge --debug
+
+echo "-- b --"
+cat b
+
+echo "-- c --"
+cat c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-copy-move-merge.out	Sat Aug 04 09:33:10 2007 -0700
@@ -0,0 +1,23 @@
+1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+resolving manifests
+ overwrite None partial False
+ ancestor 583c7b748052 local fb3948d97f07+ remote 40da226db0f0
+ a: remote moved to c -> m
+ a: remote moved to b -> m
+copying a to b
+copying a to c
+merging a and b
+my a@fb3948d97f07+ other b@40da226db0f0 ancestor a@583c7b748052
+removing a
+merging a and c
+my a@fb3948d97f07+ other c@40da226db0f0 ancestor a@583c7b748052
+0 files updated, 2 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+-- b --
+0
+1
+2
+-- c --
+0
+1
+2
--- a/tests/test-double-merge	Fri Aug 03 18:05:20 2007 -0700
+++ b/tests/test-double-merge	Sat Aug 04 09:33:10 2007 -0700
@@ -15,7 +15,7 @@
 # in another branch, change foo in a way that doesn't conflict with
 # the other changes
 hg up -qC 0
-echo line 0 >| foo
+echo line 0 > foo
 hg cat foo >> foo
 hg ci -m 'change foo' -d "1000000 0"