diff mercurial/commands.py @ 609:2acf1f5df2e6

[PATCH] hg tag: local tag support in file .hg/localtags -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] hg tag: local tag support in file .hg/localtags From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> Support local tags in .hg/localtags Also minor cleanups in related functions manifest hash: 553b2e896fed3c9055ed18482ce15cfaa4fc41ce -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCyYdJywK+sNU5EO8RAhohAKC2I3U44EXi+k4ofo5AWHBOg+94bgCfcbzs VQ2yWkPPHZycjtswOBmepa8= =v5AX -----END PGP SIGNATURE-----
author Matt Mackall <mpm@selenic.com>
date Mon, 04 Jul 2005 11:00:25 -0800
parents 94744f6fe0e7
children 4c02464cb9f0
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Jul 03 21:51:09 2005 -0800
+++ b/mercurial/commands.py	Mon Jul 04 11:00:25 2005 -0800
@@ -649,6 +649,7 @@
             b = revs.pop(0)
             off = a > b and -1 or 1
             revlist.extend(range(a, b + off, off))
+
     for i in revlist or range(log.count() - 1, -1, -1):
         show_changeset(ui, repo, filelog=filelog, rev=i)
 
@@ -851,10 +852,19 @@
     if name == "tip":
         ui.warn("abort: 'tip' is a reserved name!\n")
         return -1
+    if rev:
+        r = hg.hex(repo.lookup(rev))
+    else:
+        r = hg.hex(repo.changelog.tip())
+
     if name.find(revrangesep) >= 0:
         ui.warn("abort: '%s' cannot be used in a tag name\n" % revrangesep)
         return -1
 
+    if opts['local']:
+        repo.opener("localtags", "a").write("%s %s\n" % (r, name))
+        return
+
     (c, a, d, u) = repo.changes(None, None)
     for x in (c, a, d, u):
         if ".hgtags" in x:
@@ -862,11 +872,6 @@
             ui.status("(please commit .hgtags manually)\n")
             return -1
 
-    if rev:
-        r = hg.hex(repo.lookup(rev))
-    else:
-        r = hg.hex(repo.changelog.tip())
-
     add = 0
     if not os.path.exists(repo.wjoin(".hgtags")): add = 1
     repo.wfile(".hgtags", "a").write("%s %s\n" % (r, name))
@@ -1000,7 +1005,8 @@
                        ('t', 'templates', "", 'template map')],
               "hg serve [options]"),
     "^status": (status, [], 'hg status'),
-    "tag": (tag,  [('t', 'text', "", 'commit text'),
+    "tag": (tag,  [('l', 'local', None, 'make the tag local'),
+                   ('t', 'text', "", 'commit text'),
                    ('d', 'date', "", 'date code'),
                    ('u', 'user', "", 'user')],
             'hg tag [options] <name> [rev]'),