if val in revrange:
sys.stdout.write("reset refs/tags/%s\nfrom :%d\n\n" % (key, markmap[val]))
-def moveto_method(*args):
- "Move a file and its history to another directory."
- (revspec, args) = preamble("moveto", args)
+def dircmd(legend, hook, args):
+ (revspec, args) = preamble(legend, args)
if revspec is not None:
- croak("moveto doesn't take a revision spec")
+ croak("%s doesn't take a revision spec" % legend)
if args:
target = args.pop(0)
else:
- croak("moveto requires a sirectory argument")
+ croak("%s requires a directory argument" % legend)
if not os.path.exists(target):
croak("%s does not exist" % arg)
if not os.path.isdir(target):
elif not os.path.exists(backend.master(arg)):
croak("%s is not registered, skipping." % arg)
else:
- backend.moveto(arg, target)
+ hook(arg, target)
if not quiet and len(args) > 1:
announce("%s -> %s" % target)
+def moveto_method(*args):
+ "Move a file and its history to another directory."
+ dircmd("moveto", backend.moveto, args)
+
def copyto_method(*args):
"Copy a file and its history to another directory."
- (revspec, args) = preamble("copyto", args)
- if revspec is not None:
- croak("moveto doesn't take a revision spec")
- if args:
- target = args.pop(0)
- else:
- croak("moveto requires a sirectory argument")
- if not os.path.exists(target):
- croak("%s does not exist" % arg)
- if not os.path.isdir(target):
- croak("%s is not a directory" % arg)
- init_method(target)
- for arg in args:
- if not os.path.exists(arg):
- croak("I see no '%s' here." % arg)
- elif not os.path.exists(backend.master(arg)):
- croak("%s is not registered, skipping." % arg)
- else:
- backend.copyto(arg, target)
- if not quiet and len(args) > 1:
- announce("%s -> %s" % target)
+ dircmd("copyto", backend.copyto, args)
def ls_method(*args):
"List registered files."