subrepo: do a linear update when appropriate
authorMatt Mackall <mpm@selenic.com>
Sat, 07 Nov 2009 16:31:43 -0600
changeset 9781 eccc8aacd6f9
parent 9780 1ee085511b89
child 9782 c1c40511c276
child 9795 8eacee85d019
subrepo: do a linear update when appropriate
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Sat Nov 07 16:30:42 2009 -0600
+++ b/mercurial/subrepo.py	Sat Nov 07 16:31:43 2009 -0600
@@ -200,7 +200,12 @@
 
     def merge(self, state):
         self._get(state)
-        hg.merge(self._repo, state[1], remind=False)
+        cur = self._repo['.']
+        dst = self._repo[state[1]]
+        if dst.ancestor(cur) == cur:
+            hg.update(self._repo, state[1])
+        else:
+            hg.merge(self._repo, state[1], remind=False)
 
     def push(self, force):
         # push subrepos depth-first for coherent ordering