changeset 1654:b7fc961507db

deprecate the use of 'hg tag NAME [REV]' add some tests and some doc
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 29 Jan 2006 17:12:31 +1300
parents e8a3df8b62b3
children 7bfd4724932a
files mercurial/commands.py tests/test-tag tests/test-tag.out
diffstat 3 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Jan 29 17:10:38 2006 +1300
+++ b/mercurial/commands.py	Sun Jan 29 17:12:31 2006 +1300
@@ -2079,10 +2079,16 @@
     To facilitate version control, distribution, and merging of tags,
     they are stored as a file named ".hgtags" which is managed
     similarly to other project files and can be hand-edited if
-    necessary.
+    necessary.  The file '.hg/localtags' is used for local tags (not
+    shared among repositories).
     """
     if name == "tip":
         raise util.Abort(_("the name 'tip' is reserved"))
+    if rev_ is not None:
+        ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, "
+                  "please use 'hg tag [-r REV] NAME instead\n"))
+        if opts['rev']:
+            raise util.Abort(_("use only one form to specify the revision"))
     if opts['rev']:
         rev_ = opts['rev']
     if rev_:
@@ -2470,7 +2476,7 @@
           ('d', 'date', '', _('record datecode as commit date')),
           ('u', 'user', '', _('record user as commiter')),
           ('r', 'rev', '', _('revision to tag'))],
-         _('hg tag [OPTION]... NAME [REV]')),
+         _('hg tag [-r REV] [OPTION]... NAME')),
     "tags": (tags, [], _('hg tags')),
     "tip": (tip, [], _('hg tip')),
     "unbundle":
--- a/tests/test-tag	Sun Jan 29 17:10:38 2006 +1300
+++ b/tests/test-tag	Sun Jan 29 17:12:31 2006 +1300
@@ -10,6 +10,7 @@
 
 echo foo >> .hgtags
 hg tag -d "0 0" "bleah2" || echo "failed"
+hg tag -d "0 0" -r 0 "bleah2" 1 || echo "failed"
 
 hg revert .hgtags
 hg tag -d "0 0" -r 0 "bleah0"
--- a/tests/test-tag.out	Sun Jan 29 17:10:38 2006 +1300
+++ b/tests/test-tag.out	Sun Jan 29 17:12:31 2006 +1300
@@ -18,6 +18,10 @@
 
 abort: working copy of .hgtags is changed (please commit .hgtags manually)
 failed
+use of 'hg tag NAME [REV]' is deprecated, please use 'hg tag [-r REV] NAME instead
+abort: use only one form to specify the revision
+failed
+use of 'hg tag NAME [REV]' is deprecated, please use 'hg tag [-r REV] NAME instead
 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah
 acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0
 863197ef03781c4fc00276d83eb66c4cb9cd91df bleah1