##// END OF EJS Templates
Add some rename debugging support
mpm@selenic.com -
r1116:0cdd73b0 default
parent child Browse files
Show More
@@ -690,6 +690,9 b' def debugstate(ui, repo):'
690 690 % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2],
691 691 time.strftime("%x %X",
692 692 time.localtime(dc[file_][3])), file_))
693 ui.write("\n")
694 for f in repo.dirstate.copies:
695 ui.write("%s -> %s\n" % (repo.dirstate.copies[f], f))
693 696
694 697 def debugdata(ui, file_, rev):
695 698 """dump the contents of an data file revision"""
@@ -718,6 +721,25 b' def debugindexdot(ui, file_):'
718 721 ui.write("\t%d -> %d\n" % (r.rev(e[5]), i))
719 722 ui.write("}\n")
720 723
724 def debugrename(ui, repo, file, rev=None):
725 r = repo.file(relpath(repo, [file])[0])
726 if rev:
727 try:
728 # assume all revision numbers are for changesets
729 n = repo.lookup(rev)
730 change = repo.changelog.read(n)
731 m = repo.manifest.read(change[0])
732 n = m[relpath(repo, [file])[0]]
733 except hg.RepoError, KeyError:
734 n = r.lookup(rev)
735 else:
736 n = r.tip()
737 m = r.renamed(n)
738 if m:
739 ui.write("renamed from %s:%s\n" % (m[0], hex(m[1])))
740 else:
741 ui.write("not renamed\n")
742
721 743 def debugwalk(ui, repo, *pats, **opts):
722 744 """show how files match on given patterns"""
723 745 items = list(walk(repo, pats, opts))
@@ -1515,6 +1537,7 b' table = {'
1515 1537 "debugdata": (debugdata, [], 'debugdata FILE REV'),
1516 1538 "debugindex": (debugindex, [], 'debugindex FILE'),
1517 1539 "debugindexdot": (debugindexdot, [], 'debugindexdot FILE'),
1540 "debugrename": (debugrename, [], 'debugrename FILE [REV]'),
1518 1541 "debugwalk":
1519 1542 (debugwalk,
1520 1543 [('I', 'include', [], 'include path in search'),
@@ -40,9 +40,10 b' class filelog(revlog):'
40 40 def readmeta(self, node):
41 41 t = self.revision(node)
42 42 if not t.startswith('\1\n'):
43 return t
43 return {}
44 44 s = t.find('\1\n', 2)
45 45 mt = t[2:s]
46 m = {}
46 47 for l in mt.splitlines():
47 48 k, v = l.split(": ", 1)
48 49 m[k] = v
@@ -56,6 +57,15 b' class filelog(revlog):'
56 57 text = "\1\n" + "".join(mt) + "\1\n" + text
57 58 return self.addrevision(text, transaction, link, p1, p2)
58 59
60 def renamed(self, node):
61 if 0 and self.parents(node)[0] != nullid:
62 print "shortcut"
63 return False
64 m = self.readmeta(node)
65 if m and m.has_key("copy"):
66 return (m["copy"], bin(m["copyrev"]))
67 return False
68
59 69 def annotate(self, node):
60 70
61 71 def decorate(text, rev):
General Comments 0
You need to be logged in to leave comments. Login now