diff 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
line wrap: on
line diff
--- a/hg	Tue May 17 01:07:57 2005 -0800
+++ b/hg	Tue May 17 01:12:30 2005 -0800
@@ -199,6 +199,21 @@
 
     diff(args, *revs)
 
+elif cmd == "annotate":
+    aoptions = {}
+    opts = [('r', 'revision', '', 'revision')]
+    args = fancyopts.fancyopts(args, opts, aoptions,
+                               'hg annotate [-r id] [files]')
+    if args:
+        node = repo.current
+        if aoptions['revision']:
+            node = repo.changelog.lookup(aoptions['revision'])
+        change = repo.changelog.read(node)
+        mmap = repo.manifest.read(change[0])
+        for f in args:
+            for n, l in repo.file(f).annotate(mmap[f]):
+                sys.stdout.write("%s: %s"%(n, l))
+
 elif cmd == "export":
     node = repo.lookup(args[0])
     prev, other = repo.changelog.parents(node)