Mercurial > hg > pyhgsh
comparison hg @ 38:ed1d3e3ca8e0
Add improved rev lookup to diff and export
author | mpm@selenic.com |
---|---|
date | Sat, 07 May 2005 16:13:26 -0800 |
parents | 8708c75da2ac |
children | adf70fffca9f |
comparison
equal
deleted
inserted
replaced
37:a8811676c85a | 38:ed1d3e3ca8e0 |
---|---|
157 for f in c: print "C", f | 157 for f in c: print "C", f |
158 for f in a: print "?", f | 158 for f in a: print "?", f |
159 for f in d: print "R", f | 159 for f in d: print "R", f |
160 | 160 |
161 elif cmd == "diff": | 161 elif cmd == "diff": |
162 doptions = {} | |
163 revs = [] | 162 revs = [] |
164 | 163 |
165 if args: | 164 if args: |
165 doptions = {} | |
166 opts = [('r', 'revision', [], 'revision')] | 166 opts = [('r', 'revision', [], 'revision')] |
167 args = fancyopts.fancyopts(args, opts, doptions, | 167 args = fancyopts.fancyopts(args, opts, doptions, |
168 'hg diff [options] [files]') | 168 'hg diff [options] [files]') |
169 # revs = [ repo.lookup(x) for x in doptions['revision'] ] | 169 revs = map(lambda x: repo.changelog.lookup(x), doptions['revision']) |
170 revs = [hg.bin(x) for x in doptions['revision']] | |
171 | 170 |
172 if len(revs) > 2: | 171 if len(revs) > 2: |
173 print "too many revisions to diff" | 172 print "too many revisions to diff" |
174 sys.exit(1) | 173 sys.exit(1) |
175 else: | 174 else: |
176 diff(args, *revs) | 175 diff(args, *revs) |
177 | 176 |
178 elif cmd == "export": | 177 elif cmd == "export": |
179 node = hg.bin(args[0]) | 178 node = repo.changelog.lookup(args[0]) |
180 prev = repo.changelog.parents(node)[0] | 179 prev = repo.changelog.parents(node)[0] |
181 diff(None, prev, node) | 180 diff(None, prev, node) |
182 | 181 |
183 elif cmd == "addremove": | 182 elif cmd == "addremove": |
184 (c, a, d) = repo.diffdir(repo.root, repo.current) | 183 (c, a, d) = repo.diffdir(repo.root, repo.current) |