this help and exits.
"""
-import sys, os, getopt, re, cStringIO, subprocess, shutil
-import time, calendar, copy, shlex, email.message, email.utils
+import sys, os, getopt, re, cStringIO, subprocess
+import time, shlex, email.message, email.utils
version="0.1"
self.op = "deleteall"
else:
raise FatalException("unexpected fileop %s while parsing" % opline)
+ self.copyname = None
class Commit:
"Generic commit object."
def __init__(self, line):
self.text = line
-class FatalException:
+class FatalException(Exception):
"Unrecoverable error."
def __init__(self, msg):
self.msg = msg
if len(fields) < 3:
self.error("malformed property line")
elif len(fields) == 3:
- self.properties[fields[1]] = True
+ commit.properties[fields[1]] = True
else:
name = fields[1]
length = int(fields[2])
elif line[0] in ("C", "D", "R"):
commit.fileops.append(FileOp(line, commit))
elif line == "filedeleteall\n":
- commit.fileops.append(FileOp("filedeleteall"), commit)
+ commit.fileops.append(FileOp("filedeleteall", commit))
elif line[0] == "M":
fileop = FileOp(line, commit)
if commit.mark is None:
# a commit subpart.
continue
else:
- # Dodgy bzr autodetection hook...
- if not self.vcs:
- if "branch-nick" in commit.properties:
- for vcs in vcstypes:
- if vcs.name == "bzr":
- self.vcs = vcs
- break
pushback(line)
break
if not (commit.mark and commit.committer):
def __setitem__(self, i, v):
self.events[i] = v
-def sanecheck(event, path, mode, copyfile):
+def sanecheck(event, path, mode):
"Sanity-check an operation to see if we can cope."
if mode == "160000":
- raise FatalException("ignoring a submodule link %s", path)
+ raise FatalException("cannot import submodule link %s", path)
elif mode == "120000":
- raise FatalException("ignoring a symlink %s", path)
+ raise FatalException("cannot import a symlink %s", path)
if not mode[-3:] in ('644', '755'):
raise FatalException("unknown mode %s on %s", (mode, path))
self.maketag(reset.ref, str(rev), path)
def modify(self, event, path, mode, copyfile):
"Perform file checkins and modifications,"
- sanecheck(event, path, mode, copyfile)
+ sanecheck(event, path, mode)
self.instantiate(path, copyfile)
self.supercheckin(event, "M", path, "modify")
#self.record("M", path)
"Mark a path deleted, but don't actually remove the master."
self.instantiate(path)
open(path, "w").close()
- self.supercheckin(commit, "D", path, "delete")
+ self.supercheckin(commit, "D", path, legend)
#self.record("D", path)
def rename(self, commit, source, target):
"Perform RCS renames, carrying history with the rename."
elif op.op == "C":
if verbose >= DEBUG_OPS:
announce("%5s C '%s' '%s'" % (event.mark, op.source, op.target))
- vcs.copy(commit, ops.source, op.target)
+ vcs.copy(event, op.source, op.target)
else:
raise FatalException("unknown op type %s" % op.op)
vcs.postcommit(event)