changeset 9545:98feea5659d9

verify: detect file copy sources not in parents with --verbose
author Patrick Mezard <pmezard@gmail.com>
date Tue, 06 Oct 2009 22:46:31 +0200
parents b6b0c42739e9
children 4333b9744419
files mercurial/verify.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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")