]> thyrsus.com Git - src.git/commitdiff
Code simplification.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 17:12:01 +0000 (12:12 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 17:12:01 +0000 (12:12 -0500)
src

diff --git a/src b/src
index b38159691687cb21d51c208a12be1afb423265eb..fce15d362819626f61181d2be533238acb4edd7d 100755 (executable)
--- a/src
+++ b/src
@@ -665,6 +665,8 @@ def tag_helper(args, legend, delete_method, set_method):
         croak("%s setting requires a name argument" % legend)
     name = args.pop(0)
     ctx = CommandContext(legend, args)
+    if ctx.is_range():
+        croak("can't accept a range when setting a %s" % legend)
     for arg in ctx.args:
         metadata = History(arg)
         # Semantics differs between tags and branches here
@@ -673,13 +675,7 @@ def tag_helper(args, legend, delete_method, set_method):
             if name in metadata.symbols:
                 croak("%s %s already set." % (legend, name))
             if ctx.is_empty():
-                revision = metadata.tip().revision
-                revno = metadata.tip().revno
-            elif ctx.is_singleton():
-                revision = metadata.revno_to_rcs(ctx.start)
-                revno = ctx.start
-            else:
-                croak("can't accept a range when %s setting" % legend)
+                ctx.start = metadata.tip().revno
         elif legend == "branch":
             if not ctx.is_empty():
                 croak("cannot accept a revision after a branch name")
@@ -688,7 +684,7 @@ def tag_helper(args, legend, delete_method, set_method):
         else:
             croak("internal error - what is this thing called %s" % legend)
         with backend.lifter(arg):
-            set_method(name, revision, arg)
+            set_method(name, metadata.revno_to_rcs(ctx.start), arg)
             if not quiet and len(args) > 1:
                 announce("%s %s = %s in " % (legend, name, revno, arg))