##// END OF EJS Templates
hgk.py: add an optional file list to debug-diff-tree...
Benoit Boissinot -
r3063:aa1cee5b default
parent child Browse files
Show More
@@ -61,21 +61,23 b' def dodiff(fp, ui, repo, node1, node2, f'
61 fp.write("diff --git a/%s /dev/null\n" % (f))
61 fp.write("diff --git a/%s /dev/null\n" % (f))
62 fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, opts=opts))
62 fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, opts=opts))
63
63
64 def difftree(ui, repo, node1=None, node2=None, **opts):
64 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
65 """diff trees from two commits"""
65 """diff trees from two commits"""
66 def __difftree(repo, node1, node2):
66 def __difftree(repo, node1, node2, files=[]):
67 def date(c):
67 def date(c):
68 return time.asctime(time.gmtime(c[2][0]))
68 return time.asctime(time.gmtime(c[2][0]))
69
69
70 if node2:
70 if node2:
71 change = repo.changelog.read(node2)
71 change = repo.changelog.read(node2)
72 mmap2 = repo.manifest.read(change[0])
72 mmap2 = repo.manifest.read(change[0])
73 modified, added, removed, deleted, unknown = repo.status(node1, node2)[:5]
73 status = repo.status(node1, node2, files=files)[:5]
74 modified, added, removed, deleted, unknown = status
74 def read(f): return repo.file(f).read(mmap2[f])
75 def read(f): return repo.file(f).read(mmap2[f])
75 date2 = date(change)
76 date2 = date(change)
76 else:
77 else:
77 date2 = time.asctime()
78 date2 = time.asctime()
78 modified, added, removed, deleted, unknown = repo.status(node1)[:5]
79 status = repo.status(node1, files=files)[:5]
80 modified, added, removed, deleted, unknown = status
79 if not node1:
81 if not node1:
80 node1 = repo.dirstate.parents()[0]
82 node1 = repo.dirstate.parents()[0]
81 def read(f): return file(os.path.join(repo.root, f)).read()
83 def read(f): return file(os.path.join(repo.root, f)).read()
@@ -120,9 +122,9 b' def difftree(ui, repo, node1=None, node2'
120 if opts['patch']:
122 if opts['patch']:
121 if opts['pretty']:
123 if opts['pretty']:
122 catcommit(repo, node2, "")
124 catcommit(repo, node2, "")
123 dodiff(sys.stdout, ui, repo, node1, node2)
125 dodiff(sys.stdout, ui, repo, node1, node2, files=files)
124 else:
126 else:
125 __difftree(repo, node1, node2)
127 __difftree(repo, node1, node2, files=files)
126 if not opts['stdin']:
128 if not opts['stdin']:
127 break
129 break
128
130
@@ -332,7 +334,7 b' cmdtable = {'
332 ('s', 'stdin', None, 'stdin'),
334 ('s', 'stdin', None, 'stdin'),
333 ('C', 'copy', None, 'detect copies'),
335 ('C', 'copy', None, 'detect copies'),
334 ('S', 'search', "", 'search')],
336 ('S', 'search', "", 'search')],
335 "hg git-diff-tree [options] node1 node2"),
337 "hg git-diff-tree [options] node1 node2 [files...]"),
336 "debug-cat-file": (catfile, [('s', 'stdin', None, 'stdin')],
338 "debug-cat-file": (catfile, [('s', 'stdin', None, 'stdin')],
337 "hg debug-cat-file [options] type file"),
339 "hg debug-cat-file [options] type file"),
338 "debug-merge-base": (base, [], "hg debug-merge-base node node"),
340 "debug-merge-base": (base, [], "hg debug-merge-base node node"),
General Comments 0
You need to be logged in to leave comments. Login now