diff mercurial/commands.py @ 1116:0cdd73b0767c

Add some rename debugging support
author mpm@selenic.com
date Sat, 27 Aug 2005 20:58:53 -0700
parents 58371c4c2c8f
children 624a3a4fa232 bd917e1a26dd
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Aug 27 20:42:53 2005 -0700
+++ b/mercurial/commands.py	Sat Aug 27 20:58:53 2005 -0700
@@ -690,6 +690,9 @@
                  % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2],
                     time.strftime("%x %X",
                                   time.localtime(dc[file_][3])), file_))
+    ui.write("\n")
+    for f in repo.dirstate.copies:
+        ui.write("%s -> %s\n" % (repo.dirstate.copies[f], f))
 
 def debugdata(ui, file_, rev):
     """dump the contents of an data file revision"""
@@ -718,6 +721,25 @@
             ui.write("\t%d -> %d\n" % (r.rev(e[5]), i))
     ui.write("}\n")
 
+def debugrename(ui, repo, file, rev=None):
+    r = repo.file(relpath(repo, [file])[0])
+    if rev:
+        try:
+            # assume all revision numbers are for changesets
+            n = repo.lookup(rev)
+            change = repo.changelog.read(n)
+            m = repo.manifest.read(change[0])
+            n = m[relpath(repo, [file])[0]]
+        except hg.RepoError, KeyError:
+            n = r.lookup(rev)
+    else:
+        n = r.tip()
+    m = r.renamed(n)
+    if m:
+        ui.write("renamed from %s:%s\n" % (m[0], hex(m[1])))
+    else:
+        ui.write("not renamed\n")
+
 def debugwalk(ui, repo, *pats, **opts):
     """show how files match on given patterns"""
     items = list(walk(repo, pats, opts))
@@ -1515,6 +1537,7 @@
     "debugdata": (debugdata, [], 'debugdata FILE REV'),
     "debugindex": (debugindex, [], 'debugindex FILE'),
     "debugindexdot": (debugindexdot, [], 'debugindexdot FILE'),
+    "debugrename": (debugrename, [], 'debugrename FILE [REV]'),
     "debugwalk":
         (debugwalk,
          [('I', 'include', [], 'include path in search'),