COMMON_PYLINT = --rcfile=/dev/null --reports=n \
--msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
--dummy-variables-rgx='^_'
-PYLINTOPTS = "C0103,C0301,C0302,C0326,C1001,C0111,R0903,R0912,R0915,W0110,W0141,W0311,W0312,W0603"
+PYLINTOPTS = "C0103,C0301,C0302,C0326,C1001,C0111,R0903,R0201,R0912,R0914,R0915,W0110,W0141,W0232,W0311,W0312,W0603,W0511,W0613"
pylint:
@pylint $(COMMON_PYLINT) --disable=$(PYLINTOPTS) src
# This code uses magic tags with a 0 in the second-to-last slot to designate
# branches. It's the same format as CVS sticky tags.
#
-import sys, os, subprocess, time, calendar, stat, glob
+import sys, os, subprocess, time, calendar, stat, glob, shutil
version=0.3
except ValueError:
croak("malformed revision spec: %s" % revspec)
if require_empty and not self.is_empty():
- croak("%s doesn't take a revision spec" % legend)
+ croak("%s doesn't take a revision spec" % cmd)
if not self.args:
try:
masters = os.listdir(repodir)
# Changes the access and modification times
# Later, src status will see this. Alas,
# there's a tiny race window here.
- os.utime(backend.master(arg, None))
+ os.utime(backend.master(arg), None)
if not quiet and len(args) > 1:
announce("%s <- %d" % (arg, ctx.start))
def diff_method(*args):
"Dump diffs between revisions to standard output."
ctx = CommandContext("diff", args)
+ if type(args) == type(()):
+ args = list(args)
diffopts = "-u"
while args and args[0].startswith("-"):
diffopts += " " + args.pop(0)
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.
- backend.tag_set(newname, self.symbols[name], arg)
- backend.tag_delete(name, arg)
+ for arg in ctx.args:
+ backend.set_tag(newname, metadata.symbols[name], metadata, arg)
+ backend.delete_tag(name, arg)
if not args:
croak("%s setting requires a name argument" % legend)
name = args.pop(0)
def tag_set_validate(ctx, metadata, name):
ctx.resolve(metadata)
if name in metadata.symbols:
- croak("%s %s already set." % (legend, name))
+ croak("tag %s already set.")
if ctx.is_empty():
ctx.start = metadata.tip().revno
return metadata.revno_to_rcs(ctx.start)
def branch_method(*args):
"Inspect, create, and delete branches."
- def branch_set_validate(ctx, metadata, name):
+ def branch_set_validate(ctx, _metadata, _name):
if not ctx.is_empty():
croak("cannot accept a revision after a branch name")
tag_helper(args, "branch",
backend.delete_branch, backend.set_branch)
def filecmd(legend, hook, args):
- ctx = CommandContext(legend, args, require_empty=True)
+ CommandContext(legend, args, require_empty=True)
if len(args) != 2:
croak("%s requires exactly two arguments" % legend)
(source, target) = args
sys.stdout.write("reset refs/heads/%s\nfrom :%d\n\n" % (branch, mark))
for (key, val) in metadata.symbols.items():
val = metadata.rcs_to_revno(val)
- if val in revrange:
+ if val in ctx:
sys.stdout.write("reset refs/tags/%s\nfrom :%d\n\n" % (key, markmap[val]))
def fast_import_method(*args):
if __name__ == "__main__":
try:
- command = list(sys.argv[1:])
+ commandline = list(sys.argv[1:])
explicit = False
- while command and command[0].startswith("-"):
- if command[0] == '-d':
+ while commandline and commandline[0].startswith("-"):
+ if commandline[0] == '-d':
debug += 1
- elif command[0] == '-q':
+ elif commandline[0] == '-q':
quiet = True
- elif command[0] == '-T':
+ elif commandline[0] == '-T':
pseudotime = True
- elif command[0] == '-S':
- repodir = command[1]
+ elif commandline[0] == '-S':
+ repodir = commandline[1]
explicit = True
- command.pop(0)
- command.pop(0)
+ commandline.pop(0)
+ commandline.pop(0)
# RCS backwards-compatibility hack
if not explicit and not os.path.exists(repodir) and os.path.exists("RCS"):
# Presently there is only one backend
backend = RCS()
- if not command:
+ if not commandline:
help_method()
else:
try:
- apply(dispatch[command[0]], command[1:])
+ apply(dispatch[commandline[0]], commandline[1:])
except KeyError:
- sys.stderr.write("src: no such command as '%s'. Try 'src help'\n" \
- % command[0])
+ sys.stderr.write("src: no such commandline as '%s'. Try 'src help'\n" \
+ % commandline[0])
except KeyboardInterrupt:
pass