changeset 13001:cc4e13c92dfa

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 15 Nov 2010 17:05:54 -0600
parents 91cb08a9e7fb (current diff) 417f3c27983b (diff)
children 6747d4a5c45d
files mercurial/context.py mercurial/localrepo.py
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Thu Nov 11 15:51:20 2010 +0100
+++ b/mercurial/context.py	Mon Nov 15 17:05:54 2010 -0600
@@ -821,6 +821,11 @@
         finally:
             wlock.release()
 
+    def ancestors(self):
+        for a in self._repo.changelog.ancestors(
+            *[p.rev() for p in self._parents]):
+            yield changectx(self._repo, a)
+
     def remove(self, list, unlink=False):
         if unlink:
             for f in list:
--- a/mercurial/localrepo.py	Thu Nov 11 15:51:20 2010 +0100
+++ b/mercurial/localrepo.py	Mon Nov 15 17:05:54 2010 -0600
@@ -819,15 +819,20 @@
             if not crev:
                 self.ui.debug(" %s: searching for copy revision for %s\n" %
                               (fname, cfname))
-                for ancestor in self['.'].ancestors():
+                for ancestor in self[None].ancestors():
                     if cfname in ancestor:
                         crev = ancestor[cfname].filenode()
                         break
 
-            self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev)))
-            meta["copy"] = cfname
-            meta["copyrev"] = hex(crev)
-            fparent1, fparent2 = nullid, newfparent
+            if crev:
+                self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev)))
+                meta["copy"] = cfname
+                meta["copyrev"] = hex(crev)
+                fparent1, fparent2 = nullid, newfparent
+            else:
+                self.ui.warn(_("warning: can't find ancestor for '%s' "
+                               "copied from '%s'!\n") % (fname, cfname))
+
         elif fparent2 != nullid:
             # is one parent an ancestor of the other?
             fparentancestor = flog.ancestor(fparent1, fparent2)