Mercurial > hg > pyhgsh
comparison hg @ 79:837d473d54d5
Add basic annotation support
filelog.annotate() will get the change number on each line.
Singed-Off-by: Christopher Li<hg@chrisli.org>
author | mpm@selenic.com |
---|---|
date | Tue, 17 May 2005 01:12:30 -0800 |
parents | 401e18c95ad3 |
children | 5b7a444c794a |
comparison
equal
deleted
inserted
replaced
78:85f1f87dc8ff | 79:837d473d54d5 |
---|---|
196 relpath = os.getcwd()[len(repo.root) + 1: ] | 196 relpath = os.getcwd()[len(repo.root) + 1: ] |
197 if not args: args = [ relpath ] | 197 if not args: args = [ relpath ] |
198 else: args = [ os.path.join(relpath, x) for x in args ] | 198 else: args = [ os.path.join(relpath, x) for x in args ] |
199 | 199 |
200 diff(args, *revs) | 200 diff(args, *revs) |
201 | |
202 elif cmd == "annotate": | |
203 aoptions = {} | |
204 opts = [('r', 'revision', '', 'revision')] | |
205 args = fancyopts.fancyopts(args, opts, aoptions, | |
206 'hg annotate [-r id] [files]') | |
207 if args: | |
208 node = repo.current | |
209 if aoptions['revision']: | |
210 node = repo.changelog.lookup(aoptions['revision']) | |
211 change = repo.changelog.read(node) | |
212 mmap = repo.manifest.read(change[0]) | |
213 for f in args: | |
214 for n, l in repo.file(f).annotate(mmap[f]): | |
215 sys.stdout.write("%s: %s"%(n, l)) | |
201 | 216 |
202 elif cmd == "export": | 217 elif cmd == "export": |
203 node = repo.lookup(args[0]) | 218 node = repo.lookup(args[0]) |
204 prev, other = repo.changelog.parents(node) | 219 prev, other = repo.changelog.parents(node) |
205 change = repo.changelog.read(node) | 220 change = repo.changelog.read(node) |