add revision range selection to log

Thomas Arendsen Hein thomas at intevation.de
Sat Jul 16 07:08:10 UTC 2005


* Thomas Arendsen Hein <thomas at intevation.de> [20050716 09:02]:
> Why --revision? At the moment only hg annotate uses this, which
> probably should be changed, too. All others use --rev.
> Patch for annotate is attached and in my tree.

Now really attached ... I wonder why I did't get the reminder
that I should attach the files if I mention "attach(ing|ed|ment)" in
the mail text. Exactly for this reason I added that to my vim
installation.

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/
-------------- next part --------------
# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID 29fcd195e056c23ff5e87481087279f0eb5596eb
# Parent  7c385bd5f993018dc634569f5f65d1494f514d46
Some cleanups in commands.annotate().

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Some cleanups in commands.annotate().

manifest hash: 9581ad3bb9ebc418e4772158c505e34b92496e92
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC2K+nW7P1GVgWeRoRAr3VAKCGvKbhmG4yweZTgmxIgaZlmz16HQCdFupq
BKcWfEn17Y1l6IDbGS0rDyI=
=/fR/
-----END PGP SIGNATURE-----

diff -r 7c385bd5f993018dc634569f5f65d1494f514d46 -r 29fcd195e056c23ff5e87481087279f0eb5596eb mercurial/commands.py
--- a/mercurial/commands.py	Fri Jul 15 20:31:35 2005
+++ b/mercurial/commands.py	Sat Jul 16 06:56:39 2005
@@ -311,7 +311,7 @@
     repo.add(u)
     repo.remove(d)
 
-def annotate(u, repo, file1, *files, **ops):
+def annotate(ui, repo, file1, *files, **opts):
     """show changeset information per file line"""
     def getnode(rev):
         return hg.short(repo.changelog.node(rev))
@@ -333,12 +333,13 @@
 
     bcache = {}
     opmap = [['user', getname], ['number', str], ['changeset', getnode]]
-    if not ops['user'] and not ops['changeset']:
-        ops['number'] = 1
-
-    node = repo.dirstate.parents()[0]
-    if ops['revision']:
-        node = repo.changelog.lookup(ops['revision'])
+    if not opts['user'] and not opts['changeset']:
+        opts['number'] = 1
+
+    if opts['revision']:
+        node = repo.changelog.lookup(opts['revision'])
+    else:
+        node = repo.dirstate.parents()[0]
     change = repo.changelog.read(node)
     mmap = repo.manifest.read(change[0])
     for f in relpath(repo, (file1,) + files):
@@ -346,13 +347,13 @@
         pieces = []
 
         for o, f in opmap:
-            if ops[o]:
+            if opts[o]:
                 l = [f(n) for n, dummy in lines]
                 m = max(map(len, l))
                 pieces.append(["%*s" % (m, x) for x in l])
 
         for p, l in zip(zip(*pieces), lines):
-            u.write(" ".join(p) + ": " + l[1])
+            ui.write("%s: %s" % (" ".join(p), l[1]))
 
 def cat(ui, repo, file1, rev=None, **opts):
     """output the latest or given revision of a file"""
-------------- next part --------------
# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID 938dd667ca213149e1d72d2ac994b0e76ddb7bde
# Parent  29fcd195e056c23ff5e87481087279f0eb5596eb
Make annotate use option --rev instead od --revision like other commands.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Make annotate use option --rev instead od --revision like other commands.

manifest hash: fe9c9cd9d42657f60d302b557f1f33640fd51199
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC2LAwW7P1GVgWeRoRAqYKAJ4tiLIVTRN0Ot6bjrEZRc9VFrk3zwCdGx/C
PhOGWMHVlNYGZxmdXridIc4=
=J7Cn
-----END PGP SIGNATURE-----

diff -r 29fcd195e056c23ff5e87481087279f0eb5596eb -r 938dd667ca213149e1d72d2ac994b0e76ddb7bde mercurial/commands.py
--- a/mercurial/commands.py	Sat Jul 16 06:56:39 2005
+++ b/mercurial/commands.py	Sat Jul 16 06:58:56 2005
@@ -336,8 +336,8 @@
     if not opts['user'] and not opts['changeset']:
         opts['number'] = 1
 
-    if opts['revision']:
-        node = repo.changelog.lookup(opts['revision'])
+    if opts['rev']:
+        node = repo.changelog.lookup(opts['rev'])
     else:
         node = repo.dirstate.parents()[0]
     change = repo.changelog.read(node)
@@ -1092,7 +1092,7 @@
     "addremove": (addremove, [], "hg addremove [FILE]..."),
     "^annotate":
         (annotate,
-         [('r', 'revision', '', 'revision'),
+         [('r', 'rev', '', 'revision'),
           ('u', 'user', None, 'show user'),
           ('n', 'number', None, 'show revision number'),
           ('c', 'changeset', None, 'show changeset')],


More information about the Mercurial mailing list