fast-import -- the fast-import command: import history from other systems.
ignores -- .srcignore files and their uses.
-The 'help', 'ls', 'move', 'copy', and 'version' commands are
+The 'help', 'rename', 'ls', 'move', 'copy', and 'version' commands are
completely described in the command summary.
""",
"intro": """
tracked, I = ignored, L = locked (recover with src checkout).
Find more details under 'help status'. 'st' is a synonym fot status.
-src tag [list|-l|delete|del|-d|rename|-r] ['name'] ['revision'] ['file'...]
- Create, rename, or delete a tag. With no or only file arguments, list tags.
+src tag [list|-l|delete|del|-d] ['name'] ['revision'] ['file'...]
+ Create or delete a tag. With no or only file arguments, list tags.
-src branch [list|-l|delete|del|-d|rename|-r] ['name'] ['revision'] ['file'...]
- Create, rename, switch to, or delete a branch. With no arguments,
+src branch [list|-l|delete|del|-d] ['name'] ['revision'] ['file'...]
+ Create, switch to, or delete a branch. With no arguments,
list branches; the active branch is first in the list. The default
branch is 'trunk'.
+src rename ['tag'|'branch'] ['oldname'] ['newname'] ['file'...]
+ Rename a tag or branch. Refuses to step on an existing symbol or
+ rename a nonexistent one. 'rn' is a synonym for 'rename'.
+
src list ['revision-range'] ['file'...]
Sends summary information about the specified commits to standard output.
The summary line tagged with '*' is the state that the file would
src move 'old' 'new'
Rename a workfile and its history. Refuses to step on existing
- workfiles or histories. 'mv' and 'rename' are synonyms.
+ workfiles or histories. 'mv' is a synonym for 'move'.
src copy 'old' 'new'
Copy a workfile and its history. Refuses to step on existing files
if backend.isbranch(value) == (legend == "branch"):
sys.stdout.write("%4s\t%s\n" % (display,key))
return
- if args[0] in ("-r", "rename"):
- args.pop(0)
- if not args:
- 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)
- ctx = CommandContext(legend + " renaming", args, require_empty=True)
- for arg in ctx.args:
- metadata = History(arg)
- if name not in metadata.symbols:
- croak("in %s, cannot rename nonexistent %s %s" % (arg, legend, name))
- if newname in metadata.symbols:
- croak("in %s, cannot rename to existing %s %s" % (arg, 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)
- backend.delete_tag(name, metadata)
- if not quiet and len(args) > 1:
- announce("in %s, %s -> %s" % (arg, name, newname))
- return
if not args:
croak("%s setting requires a name argument" % legend)
name = args.pop(0)
branch_set_validate,
backend.delete_branch, backend.set_branch)
+def rename_method(*args):
+ "Rename a branch or tag."
+ args = list(args)
+ if not args or args[0] not in ("tag", "branch"):
+ croak("rename requires a following 'tag' or 'branch'")
+ legend = args.pop(0)
+ if not args:
+ croak("rename requires a source name argument")
+ name = args.pop(0)
+ if not args:
+ croak("rename requires a target name argument")
+ newname = args.pop(0)
+ ctx = CommandContext(legend + " renaming", args, require_empty=True)
+ for arg in ctx.args:
+ metadata = History(arg)
+ if name not in metadata.symbols:
+ croak("in %s, cannot rename nonexistent %s %s" % (arg, legend, name))
+ if newname in metadata.symbols:
+ croak("in %s, cannot rename to existing %s %s" % (arg, 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)
+ backend.delete_tag(name, metadata)
+ if not quiet and len(args) > 1:
+ announce("in %s, %s -> %s" % (arg, name, newname))
+
def filecmd(legend, hook, args):
CommandContext(legend, args, require_empty=True)
if len(args) != 2:
"di": diff_method,
"tag": tag_method,
"branch": branch_method,
+ "rn": rename_method,
+ "rename": rename_method,
"ls": ls_method,
"move": move_method,
"mv": move_method,
- "rename": move_method,
"copy": copy_method,
"cp": copy_method,
"fast-export": fast_export_method,
give the -a switch or specify which files to look at. "st" is a
synonym for status.
-src tag [list|-ldelete|del|-d}rename|-r] ['name'] ['revision'] ['file'...]::
- Create, rename, or delete a tag. With no or only file arguments, list tags.
+src tag [list|-l|delete|del|-d] ['name'] ['revision'] ['file'...]::
+ Create or delete a tag. With no or only file arguments, list tags.
-src branch [list|-l|delete|del|-d] ['name'] ['revision'] ['file...']::
- Create, rename, switch to, or delete a branch. With no arguments,
+src branch [list|-l|delete|del|-d] ['name'] ['revision'] ['file'...]::
+ Create, switch to, or delete a branch. With no arguments,
list branches; the active branch is first in the list. The default
branch is 'trunk'.
+src rename ['tag'|'branch'] ['oldname'] ['newname'] ['file'...]::
+ Rename a tag or branch. Refuses to step on an existing symbol or
+ rename a nonexistent one. 'rn' is a synonym for 'rename'.
+
src list ['revision-range'] ['file'...]::
Sends summary information about the specified commits to standard output.
The summary line tagged with '*' is the state that the file would
src ls::
List all registered files.
-src rename 'old' 'new'::
+src move 'old' 'new'::
Rename a workfile and its history. Refuses to step on existing
- workfiles or histories. 'mv' and 'rename' are synonyms.
+ workfiles or histories. 'mv' is a synonym for 'move'.
src copy 'old' 'new'::
Copy a file and its master. Refuses to step on existing files or masters.