return
if args[0] in ("-l", "list"):
args.pop(0)
- ctx = CommandContext(legend, args)
- if not ctx.is_empty():
- croak("can't accept a revision-spec when %s listing." % legend)
+ ctx = CommandContext(legend + " listing", args, require_empty=True)
width = screenwidth()
for arg in ctx.args:
metadata = History(arg)
return
if args[0] in ("-r", "rename"):
args.pop(0)
- if name not in metadata.symbols:
- croak("cannot rename nonexistent %s" % legend)
if not args:
- croak("rename requires a second name argement")
+ croak("rename requires a source name argement")
+ name = args.pop(0)
+ if not args:
+ croak("rename requires a target name argement")
newname = args.pop(0)
- if newname in metadata.symbols:
- croak("cannot rename to existing %s" % legend)
- ctx = CommandContext(legend, args)
- if not ctx.is_empty():
- croak("can't accept a revision-spec when %s renaming." % legend)
- # In the case of a branch, we want to change only the tag reference.
+ ctx = CommandContext(legend + " renaming", args, require_empty=True)
for arg in ctx.args:
- backend.set_tag(newname, metadata.symbols[name], metadata, arg)
- backend.delete_tag(name, arg)
+ metadata = History(arg)
+ if name not in metadata.symbols:
+ croak("cannot rename nonexistent %s %s" % (legend, name))
+ if newname in metadata.symbols:
+ croak("cannot rename to existing %s %s" % (legend, name))
+ ctx = CommandContext(legend, args)
+ if not ctx.is_empty():
+ croak("can't accept a revision-spec when renaming a %s." \
+ % legend)
+ # In the case of a branch, we want to change only the
+ # tag reference.
+ with backend.lifter(arg):
+ backend.set_tag(newname, metadata.symbols[name], metadata, arg)
+ backend.delete_tag(name, arg)
+ if not quiet and len(args) > 1:
+ announce("%s -> %s in %s" % (name, newname, arg))
+ return
if not args:
croak("%s setting requires a name argument" % legend)
name = args.pop(0)
with backend.lifter(arg):
set_method(name, revision, metadata, arg)
if not quiet and len(args) > 1:
- announce("%s %s = %s in " % (legend, name, revno, arg))
- pass
+ announce("%s %s = %s in %s" % (legend, name, revno, arg))
def tag_method(*args):
"Inspect, create, and delete tags."