fp.write(path)
fp.write("\n")
@staticmethod
- def instantiate(path, copyfile):
+ def instantiate(path, copyfile=None):
rcsdir = os.path.join(os.path.dirname(path), "RCS")
if not os.path.exists(rcsdir):
try:
os.makedirs(rcsdir)
except OSError:
raise FatalException("can't create %s." % rcsdir)
- if verbose >= DEBUG_SHUFFLE:
- announce("linking %s to %s" % (os.path.relpath(copyfile), path))
- if not dryrun:
- try:
- os.link(copyfile, path)
- except OSError, e:
- raise FatalException("refusing to step on %s: %s." % (path, `e`))
+ if copyfile:
+ if verbose >= DEBUG_SHUFFLE:
+ announce("linking %s to %s" % (os.path.relpath(copyfile), path))
+ if not dryrun:
+ try:
+ os.link(copyfile, path)
+ except OSError, e:
+ raise FatalException("refusing to step on %s: %s." % (path, `e`))
+ return rcsdir
def normal_checkin(self, commit, path, legend, state=None):
if self.roundtrip:
comment = event.email_out()
RCS.record("M", path)
def delete(self, commit, path, legend="delete"):
"Mark a path deleted, but don't actually remove the master."
- RCS.instantiate(path, "/dev/null")
+ RCS.instantiate(path)
+ open(path, "w").close()
self.normal_checkin(commit, path, legend="delete", state="Deleted")
RCS.record("D", path)
def copy(self, commit, source, target, legend="Copy"):
if os.path.exists(RCS.master(target)):
raise FatalException("copy to existing file")
do_or_die("co %s" % RCS.master(source), legend)
+ RCS.instantiate(target)
loud_rename(source, target)
self.normal_checkin(commit, target, legend="copy")
RCS.record("C", source)