Show More
@@ -9,6 +9,15 b' from mercurial.demandload import *' | |||||
9 | demandload(globals(), 'time sys signal os') |
|
9 | demandload(globals(), 'time sys signal os') | |
10 | demandload(globals(), 'mercurial:hg,mdiff,fancyopts,commands,ui,util') |
|
10 | demandload(globals(), 'mercurial:hg,mdiff,fancyopts,commands,ui,util') | |
11 |
|
11 | |||
|
12 | def filterfiles(files, filters): | |||
|
13 | l = [x for x in filters if x in files] | |||
|
14 | ||||
|
15 | for t in files: | |||
|
16 | if not t.endswith("/"): | |||
|
17 | t += "/" | |||
|
18 | l += [x for x in filters if x.startswith(t)] | |||
|
19 | return l | |||
|
20 | ||||
12 | def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, |
|
21 | def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, | |
13 | changes=None, text=False): |
|
22 | changes=None, text=False): | |
14 | def date(c): |
|
23 | def date(c): | |
@@ -41,13 +50,13 b' def dodiff(fp, ui, repo, node1, node2, f' | |||||
41 | mmap = repo.manifest.read(change[0]) |
|
50 | mmap = repo.manifest.read(change[0]) | |
42 | date1 = date(change) |
|
51 | date1 = date(change) | |
43 |
|
52 | |||
|
53 | opts = mdiff.diffopts() | |||
|
54 | opts.text = text | |||
44 | for f in modified: |
|
55 | for f in modified: | |
45 | to = None |
|
56 | to = None | |
46 | if f in mmap: |
|
57 | if f in mmap: | |
47 | to = repo.file(f).read(mmap[f]) |
|
58 | to = repo.file(f).read(mmap[f]) | |
48 | tn = read(f) |
|
59 | tn = read(f) | |
49 | opts = mdiff.diffopts() |
|
|||
50 | opts.text = text |
|
|||
51 | fp.write("diff --git a/%s b/%s\n" % (f, f)) |
|
60 | fp.write("diff --git a/%s b/%s\n" % (f, f)) | |
52 | fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, opts=opts)) |
|
61 | fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, opts=opts)) | |
53 | for f in added: |
|
62 | for f in added: | |
@@ -64,27 +73,19 b' def dodiff(fp, ui, repo, node1, node2, f' | |||||
64 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): |
|
73 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): | |
65 | """diff trees from two commits""" |
|
74 | """diff trees from two commits""" | |
66 | def __difftree(repo, node1, node2, files=[]): |
|
75 | def __difftree(repo, node1, node2, files=[]): | |
67 | def date(c): |
|
|||
68 | return time.asctime(time.gmtime(c[2][0])) |
|
|||
69 |
|
||||
70 | if node2: |
|
76 | if node2: | |
71 | change = repo.changelog.read(node2) |
|
77 | change = repo.changelog.read(node2) | |
72 | mmap2 = repo.manifest.read(change[0]) |
|
78 | mmap2 = repo.manifest.read(change[0]) | |
73 | status = repo.status(node1, node2, files=files)[:5] |
|
79 | status = repo.status(node1, node2, files=files)[:5] | |
74 | modified, added, removed, deleted, unknown = status |
|
80 | modified, added, removed, deleted, unknown = status | |
75 | def read(f): return repo.file(f).read(mmap2[f]) |
|
|||
76 | date2 = date(change) |
|
|||
77 | else: |
|
81 | else: | |
78 | date2 = time.asctime() |
|
|||
79 | status = repo.status(node1, files=files)[:5] |
|
82 | status = repo.status(node1, files=files)[:5] | |
80 | modified, added, removed, deleted, unknown = status |
|
83 | modified, added, removed, deleted, unknown = status | |
81 | if not node1: |
|
84 | if not node1: | |
82 | node1 = repo.dirstate.parents()[0] |
|
85 | node1 = repo.dirstate.parents()[0] | |
83 | def read(f): return file(os.path.join(repo.root, f)).read() |
|
|||
84 |
|
86 | |||
85 | change = repo.changelog.read(node1) |
|
87 | change = repo.changelog.read(node1) | |
86 | mmap = repo.manifest.read(change[0]) |
|
88 | mmap = repo.manifest.read(change[0]) | |
87 | date1 = date(change) |
|
|||
88 | empty = "0" * 40; |
|
89 | empty = "0" * 40; | |
89 |
|
90 | |||
90 | for f in modified: |
|
91 | for f in modified: | |
@@ -288,7 +289,7 b' def revtree(args, repo, full="tree", max' | |||||
288 | parentstr += " " + hg.short(pp[1]) |
|
289 | parentstr += " " + hg.short(pp[1]) | |
289 | if not full: |
|
290 | if not full: | |
290 | print hg.short(n) + parentstr |
|
291 | print hg.short(n) + parentstr | |
291 |
elif full |
|
292 | elif full == "commit": | |
292 | print hg.short(n) + parentstr |
|
293 | print hg.short(n) + parentstr | |
293 | catcommit(repo, n, ' ', changes) |
|
294 | catcommit(repo, n, ' ', changes) | |
294 | else: |
|
295 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now