return content
class HistoryEntry:
- "Capture the state of an RCS revision item in the log."
- def __init__(self, master):
- self.master = master
+ "Capture the state of a native revision item in the log."
+ def __init__(self, history):
+ self.history = history
self.revno = None
- self.native = None
+ self.native = None # magic cookie only interpreted by back end
self.log = ""
self.date = None
def selected(self):
- return self.native == self.master.current()
+ return self.native == self.history.current()
def unixtime(self):
try:
return calendar.timegm(time.strptime(self.date, "%Y-%m-%dT%H:%M:%SZ"))
self.symbols = {}
self.branch = "trunk"
self.lockrevs = []
- if not os.path.exists(backend.master(self.name)):
+ if not os.path.exists(backend.history(self.name)):
croak("%s is not registered" % self.name)
backend.parse(self)
self.by_revno_d = {}
for arg in ctx.args:
if not os.path.exists(arg):
croak("I see no '%s' here." % arg)
- if os.path.exists(backend.master(arg)):
+ if os.path.exists(backend.history(arg)):
metadata = History(arg)
ctx.resolve(metadata)
if ctx.is_empty():
if not comment.edit(content="", trailer=trailer):
announce("in %s, commit cancelled" % arg)
else:
- if not os.path.exists(backend.master(arg)):
+ if not os.path.exists(backend.history(arg)):
backend.add(arg)
with backend.lifter(arg):
backend.checkin(arg, comment.content())
for arg in ctx.args:
if not os.path.exists(arg):
croak("I see no '%s' here." % arg)
- elif not os.path.exists(backend.master(arg)):
+ elif not os.path.exists(backend.history(arg)):
croak("%s is not registered." % arg)
for arg in ctx.args:
metadata = History(arg)
# We change access and modification times of
# both history and workfile to avoid a race
# condition if src status is donw within a second.
- st = os.stat(backend.master(arg))
- os.utime(backend.master(arg), (st.st_atime, st.st_mtime))
+ st = os.stat(backend.history(arg))
+ os.utime(backend.history(arg), (st.st_atime, st.st_mtime))
os.utime(arg, (st.st_atime-1, st.st_mtime-1))
if not quiet and len(args) > 1:
announce("%s <- %d" % (arg, ctx.start))
if fn in args:
pairs.append((fn, "I"))
continue
- masterbase = os.path.basename(backend.master(fn))
+ masterbase = os.path.basename(backend.history(fn))
if masterbase not in registered:
pairs.append((fn, "?"))
elif not os.path.exists(fn):
pairs.append((fn, "!"))
# Relies on the fact that we touch the file with utimes(2)
# each time it's checked out.
- elif os.path.getmtime(fn) > os.path.getmtime(backend.master(fn)):
+ elif os.path.getmtime(fn) > os.path.getmtime(backend.history(fn)):
pairs.append((fn, "M"))
elif not backend.has_revisions(fn):
pairs.append((fn, "A"))
(source, target) = args
if not os.path.exists(source):
croak("I see no '%s' here." % source)
- elif not os.path.exists(backend.master(source)):
+ elif not os.path.exists(backend.history(source)):
croak("%s is not registered, skipping" % source)
- elif os.path.exists(backend.master(target)):
+ elif os.path.exists(backend.history(target)):
croak("%s is registered, I won't step on it" % source)
elif os.path.exists(target):
croak("%s exists, please delete manually if you want it gone" % target)
for arg in ctx.args:
if not os.path.exists(arg):
croak("I see no '%s' here." % arg)
- elif not os.path.exists(backend.master(arg)):
+ elif not os.path.exists(backend.history(arg)):
croak("%s is not registered, skipping" % arg)
else:
with backend.lifter(arg):
useremail = capture_or_die("git config --get user.email").strip()
attribution = "%s <%s>" % (username, useremail)
for arg in ctx.args:
- if not os.path.exists(backend.master(arg)):
+ if not os.path.exists(backend.history(arg)):
croak("%s is not registered" % arg)
executable = os.stat(arg).st_mode & stat.S_IXUSR
if executable:
return True
def lifter(self, name):
return RCS.RCSLifter(name)
- def master(self, arg):
+ def history(self, arg):
if os.sep not in arg:
return os.path.join(repodir, arg + ",v")
else:
# The motivation here is to make "src status" faster by avoiding
# the need for an entire log parse when checking for "A"
# status.
- return os.path.getsize(self.master(arg)) > 105
+ return os.path.getsize(self.history(arg)) > 105
def workfile(self, arg):
"Workfile correponding to an RCS master"
return arg[:-2]
def move(self, source, target):
"Move a file and its history."
do_or_die("mv {0} {1} && mv {2} {3}".format(source, target,
- self.master(source),
- self.master(target)))
+ self.history(source),
+ self.history(target)))
def copy(self, source, target):
"Copy a file and its history."
do_or_die("cp {0} {1} && cp {2} {3}".format(source, target,
- self.master(source),
- self.master(target)))
+ self.history(source),
+ self.history(target)))
def diff(self, diffspec1, diffspec2, diffopts, arg):
"Report a diff."
if diffspec1: