#
# makefile for rcs-fast-import
#
-VERS=$(shell sed <rcs-fast-import -n -e '/version=\(.*\)/s//\1/p')
+VERS=$(shell sed <rcs-fast-import -n -e '/version *= *\(.*\)/s//\1/p')
SOURCES = README COPYING NEWS rcs-fast-import rcs-fast-import.xml Makefile control
(cd ..; tar -czvf rcs-fast-import/rcs-fast-import-$(VERS).tar.gz `cat rcs-fast-import/MANIFEST`)
@(cd ..; rm rcs-fast-import-$(VERS))
-pychecker:
- @echo "Expect four messages about unknown methods checkin and maketag."
- @ln -f rcs-fast-import rcs-fast-import.py
- @-pychecker --quiet --only --limit 50 rcs-fast-import.py
- @rm -f rcs-fast-import.py rcs-fast-import.pyc
+PYLINTOPTS = --rcfile=/dev/null --reports=n --include-ids=y --disable="C0103,C0111,C0301,C0323,R0902,R0903,R0912,R0913,R0914,R0915,W0141,W0333,W0142,W0621,E1101"
+pylint:
+ @pylint --output-format=parseable $(PYLINTOPTS) rcs-fast-import
version:
@echo $(VERS)
import sys, os, getopt, re, cStringIO, subprocess
import time, shlex, email.message, email.utils
-version="0.1"
+version = "0.1"
#
# Generic import-stream machinery swiped from reposurgeon begins here.
self.stream = sys.stdout
else:
self.stream = None
+ self.count = 0
+ self.time = 0
def __enter__(self):
if self.stream:
self.stream.write(self.prompt + "...")
self.childbranches = [] # Count of child branches at this point.
def children(self):
"Get a list of this commit's children."
- return filter(lambda e:self.mark in e.parent_marks,self.repo.commits())
+ return filter(lambda e:self.mark in e.parent_marks, self.repo.commits())
def parents(self):
"Get a list of this commit's parents."
- return filter(lambda e:e.mark in self.parent_marks,self.repo.commits())
+ return filter(lambda e:e.mark in self.parent_marks, self.repo.commits())
def is_tip(self):
"Is this commit a branch tip?"
# Added for rcs-fast-import
class FatalException(Exception):
"Unrecoverable error."
def __init__(self, msg):
+ Exception.__init__(self)
self.msg = msg
class Repository:
with Baton("rcs-fast-import:", enable=progress) as baton:
self.import_line = 0
linebuffers = []
- ncommits = 0
def read_data(dp, line=None):
if not line:
line = readline()
commit = Commit(self)
commit.branch = line.split()[1]
self.branches.add(commit.branch)
- ncommits += 1
while True:
line = readline()
if not line:
def __setitem__(self, i, v):
self.events[i] = v
-def sanecheck(event_unused, path, mode):
+def sanecheck(_event, path, mode):
"Sanity-check an operation to see if we can cope."
if mode == "160000":
raise FatalException("cannot import submodule link %s" % path)
try:
os.link(copyfile, path)
except OSError, e:
- raise FatalException("refusing to step on %s: %s." % (path,`e`))
+ raise FatalException("refusing to step on %s: %s." % (path, `e`))
return rcsdir
def masterfiles(self):
"List all masters."
res = []
- for root, dirs, files in os.walk(os.getcwd(), topdown=False):
+ for root, _dirs, files in os.walk(os.getcwd(), topdown=False):
if root.endswith(os.sep + self.__class__.repodirectory):
for name in files:
res.append(os.path.join(root, name))
def supercheckin(self, commit, op, path, legend):
"You knew the job was dangerous when you took it."
if self.roundtrip:
- comment = event.email_out()
+ comment = commit.email_out()
else:
- comment = event.comment
+ comment = commit.comment
rev = self.make_tip(commit, path)
do_or_die(self.checkin(commit, comment, op, path, rev), legend)
loud_remove(path)
checkout_mode = None
roundtrip = True
for (switch, val) in options:
- if (switch == '-?'):
- print __doc__
+ if (switch == '-?'):
+ print __doc__
raise SystemExit, 0
elif switch == '-p':
roundtrip = False
elif switch in ('-l', '-u'):
checkout_mode = switch
- elif (switch == '-v'):
- verbose += 1
- elif (switch == '-V'):
- print "rcs-fast-import version %s" % version
+ elif (switch == '-v'):
+ verbose += 1
+ elif (switch == '-V'):
+ print "rcs-fast-import version %s" % version
vcs = RCS()
vcs.roundtrip = roundtrip
elif op.op in ("D", "deleteall"):
if verbose >= DEBUG_OPS:
announce("%5s D %s" % (event.mark, op.path))
- vcs.delete(op.path)
+ vcs.delete(event, op.path)
elif op.op == "R":
if verbose >= DEBUG_OPS:
announce("%5s R '%s' '%s'" % (event.mark, op.source, op.target))