verify: detect file copy sources not in parents with --verbose
authorPatrick Mezard <pmezard@gmail.com>
Tue, 06 Oct 2009 22:46:31 +0200
changeset 9545 98feea5659d9
parent 9544 b6b0c42739e9
child 9546 4333b9744419
verify: detect file copy sources not in parents with --verbose
mercurial/verify.py
--- a/mercurial/verify.py	Tue Oct 06 16:08:38 2009 -0500
+++ b/mercurial/verify.py	Tue Oct 06 22:46:31 2009 +0200
@@ -173,6 +173,7 @@
         elif size > 0:
             storefiles.add(f)
 
+    lrugetctx = util.lrucachefunc(repo.changectx)
     files = sorted(set(filenodes) | set(filelinkrevs))
     for f in files:
         try:
@@ -224,6 +225,16 @@
             # check renames
             try:
                 if rp:
+                    if lr is not None and ui.verbose:
+                        ctx = lrugetctx(lr)
+                        found = False
+                        for pctx in ctx.parents():
+                            if rp[0] in pctx:
+                                found = True
+                                break
+                        if not found:
+                            warn(_("warning: copy source of '%s' not"
+                                   " in parents of %s") % (f, ctx))
                     fl2 = repo.file(rp[0])
                     if not len(fl2):
                         err(lr, _("empty or missing copy source revlog %s:%s")