Mercurial > hg
comparison hgext/hgk.py @ 14671:35c2cc322ba8
scmutil: switch match users to supplying contexts
The most appropriate context is not always clearly defined. The obvious cases:
For working directory commands, we use None
For commands (eg annotate) with single revs, we use that revision
The less obvious cases:
For commands (eg status, diff) with a pair of revs, we use the second revision
For commands that take a range (like log), we use None
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 18 Jun 2011 16:52:51 -0500 |
parents | a90131b85fd8 |
children | 525fdb738975 |
comparison
equal
deleted
inserted
replaced
14670:19197fa4c41c | 14671:35c2cc322ba8 |
---|---|
43 """diff trees from two commits""" | 43 """diff trees from two commits""" |
44 def __difftree(repo, node1, node2, files=[]): | 44 def __difftree(repo, node1, node2, files=[]): |
45 assert node2 is not None | 45 assert node2 is not None |
46 mmap = repo[node1].manifest() | 46 mmap = repo[node1].manifest() |
47 mmap2 = repo[node2].manifest() | 47 mmap2 = repo[node2].manifest() |
48 m = scmutil.match(repo, files) | 48 m = scmutil.match(repo[node1], files) |
49 modified, added, removed = repo.status(node1, node2, m)[:3] | 49 modified, added, removed = repo.status(node1, node2, m)[:3] |
50 empty = short(nullid) | 50 empty = short(nullid) |
51 | 51 |
52 for f in modified: | 52 for f in modified: |
53 # TODO get file permissions | 53 # TODO get file permissions |
79 node2 = node1 | 79 node2 = node1 |
80 node1 = repo.changelog.parents(node1)[0] | 80 node1 = repo.changelog.parents(node1)[0] |
81 if opts['patch']: | 81 if opts['patch']: |
82 if opts['pretty']: | 82 if opts['pretty']: |
83 catcommit(ui, repo, node2, "") | 83 catcommit(ui, repo, node2, "") |
84 m = scmutil.match(repo, files) | 84 m = scmutil.match(repo[node1], files) |
85 chunks = patch.diff(repo, node1, node2, match=m, | 85 chunks = patch.diff(repo, node1, node2, match=m, |
86 opts=patch.diffopts(ui, {'git': True})) | 86 opts=patch.diffopts(ui, {'git': True})) |
87 for chunk in chunks: | 87 for chunk in chunks: |
88 ui.write(chunk) | 88 ui.write(chunk) |
89 else: | 89 else: |