mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
refactor debugrenamed
This commit is contained in:
parent
040dd9d149
commit
37174271f4
@ -960,25 +960,17 @@ def debugindexdot(ui, file_):
|
||||
ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
|
||||
ui.write("}\n")
|
||||
|
||||
def debugrename(ui, repo, file, rev=None):
|
||||
def debugrename(ui, repo, file1, *pats, **opts):
|
||||
"""dump rename information"""
|
||||
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"))
|
||||
|
||||
ctx = repo.changectx(opts.get('rev', 'tip'))
|
||||
for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts,
|
||||
ctx.node()):
|
||||
m = ctx.filectx(abs).renamed()
|
||||
if m:
|
||||
ui.write(_("%s renamed from %s:%s\n") % (rel, m[0], hex(m[1])))
|
||||
else:
|
||||
ui.write(_("%s not renamed\n") % rel)
|
||||
|
||||
def debugwalk(ui, repo, *pats, **opts):
|
||||
"""show how files match on given patterns"""
|
||||
|
@ -4,9 +4,9 @@ copy: foo -> bar
|
||||
# should match
|
||||
rev offset length base linkrev nodeid p1 p2
|
||||
0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000
|
||||
renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
|
||||
bar renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
|
||||
# should not be renamed
|
||||
not renamed
|
||||
bar not renamed
|
||||
# should show copy
|
||||
copy: foo -> bar
|
||||
# should show no parents for tip
|
||||
@ -18,5 +18,5 @@ copy: foo -> bar
|
||||
rev offset length base linkrev nodeid p1 p2
|
||||
0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000
|
||||
1 5 7 1 2 dd12c926cf16 2ed2a3912a0b 000000000000
|
||||
renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
|
||||
bar renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
|
||||
# should show no copies
|
||||
|
@ -22,4 +22,4 @@ blahblah
|
||||
rev offset length base linkrev nodeid p1 p2
|
||||
0 0 67 0 1 dc51707dfc98 000000000000 000000000000
|
||||
1 67 72 1 3 b2494a44f0a9 000000000000 dc51707dfc98
|
||||
renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
|
||||
b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
|
||||
|
Loading…
Reference in New Issue
Block a user