Mercurial > hg
comparison contrib/hgit @ 719:dda258572847
Fix hgit usage of repo.changes and fancyopts to reflect current hg api
author | mason@suse.com |
---|---|
date | Tue, 19 Jul 2005 12:40:46 -0500 |
parents | 688d03d6997a |
children | 095dd8c757e0 |
comparison
equal
deleted
inserted
replaced
718:7dae73778114 | 719:dda258572847 |
---|---|
16 return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) | 16 return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) |
17 | 17 |
18 if node2: | 18 if node2: |
19 change = repo.changelog.read(node2) | 19 change = repo.changelog.read(node2) |
20 mmap2 = repo.manifest.read(change[0]) | 20 mmap2 = repo.manifest.read(change[0]) |
21 (c, a, d) = repo.diffrevs(node1, node2) | 21 (c, a, d, u) = repo.changes(node1, node2) |
22 def read(f): return repo.file(f).read(mmap2[f]) | 22 def read(f): return repo.file(f).read(mmap2[f]) |
23 date2 = date(change) | 23 date2 = date(change) |
24 else: | 24 else: |
25 date2 = time.asctime() | 25 date2 = time.asctime() |
26 (c, a, d, u) = repo.diffdir(repo.root, node1) | 26 (c, a, d, u) = repo.diffdir(repo.root, node1) |
49 revs = [] | 49 revs = [] |
50 if args: | 50 if args: |
51 doptions = {} | 51 doptions = {} |
52 opts = [('p', 'patch', None, 'patch'), | 52 opts = [('p', 'patch', None, 'patch'), |
53 ('r', 'recursive', None, 'recursive')] | 53 ('r', 'recursive', None, 'recursive')] |
54 args = fancyopts.fancyopts(args, opts, doptions, | 54 args = fancyopts.fancyopts(args, opts, doptions) |
55 'hg diff-tree [options] sha1 sha1') | |
56 | 55 |
57 if len(args) < 2: | 56 if len(args) < 2: |
58 help() | 57 help() |
59 sys.exit(1) | 58 sys.exit(1) |
60 revs.append(repo.lookup(args[0])) | 59 revs.append(repo.lookup(args[0])) |
61 revs.append(repo.lookup(args[1])) | 60 revs.append(repo.lookup(args[1])) |
62 args = args[2:] | 61 args = args[2:] |
63 if doptions['patch']: | 62 if doptions['patch']: |
64 commands.dodiff(ui, repo, "", args, *revs) | 63 commands.dodiff(sys.stdout, ui, repo, args, *revs) |
65 else: | 64 else: |
66 __difftree(repo, args, *revs) | 65 __difftree(repo, args, *revs) |
67 | 66 |
68 def catcommit(repo, n, prefix): | 67 def catcommit(repo, n, prefix): |
69 nlprefix = '\n' + prefix; | 68 nlprefix = '\n' + prefix; |
85 print changes[4] | 84 print changes[4] |
86 | 85 |
87 def catfile(args, ui, repo): | 86 def catfile(args, ui, repo): |
88 doptions = {} | 87 doptions = {} |
89 opts = [('s', 'stdin', None, 'stdin')] | 88 opts = [('s', 'stdin', None, 'stdin')] |
90 args = fancyopts.fancyopts(args, opts, doptions, | 89 args = fancyopts.fancyopts(args, opts, doptions) |
91 'hg cat-file type sha1') | |
92 | 90 |
93 # in stdin mode, every line except the commit is prefixed with two | 91 # in stdin mode, every line except the commit is prefixed with two |
94 # spaces. This way the our caller can find the commit without magic | 92 # spaces. This way the our caller can find the commit without magic |
95 # strings | 93 # strings |
96 # | 94 # |
207 # parameter | 205 # parameter |
208 def revlist(args, repo): | 206 def revlist(args, repo): |
209 doptions = {} | 207 doptions = {} |
210 opts = [('c', 'commit', None, 'commit'), | 208 opts = [('c', 'commit', None, 'commit'), |
211 ('n', 'max-nr', 0, 'max-nr')] | 209 ('n', 'max-nr', 0, 'max-nr')] |
212 args = fancyopts.fancyopts(args, opts, doptions, | 210 args = fancyopts.fancyopts(args, opts, doptions) |
213 'hg rev-list') | |
214 if doptions['commit']: | 211 if doptions['commit']: |
215 full = "commit" | 212 full = "commit" |
216 else: | 213 else: |
217 full = None | 214 full = None |
218 for i in range(1, len(args)): | 215 for i in range(1, len(args)): |