From 7a9950cd006123f64a714f31761a5539b5d7612d Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 13 Nov 2014 14:28:38 -0500 Subject: [PATCH] Renames for clarity. Regression test passes. --- src | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src b/src index e5fbbb0..b8b3660 100755 --- a/src +++ b/src @@ -152,15 +152,15 @@ def capture_or_die(command): 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")) @@ -175,7 +175,7 @@ class History: 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 = {} @@ -573,7 +573,7 @@ def commit_method(*args): 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(): @@ -586,7 +586,7 @@ def commit_method(*args): 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()) @@ -605,7 +605,7 @@ def amend_method(*args): 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) @@ -669,8 +669,8 @@ def checkout_method(*args): # 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)) @@ -696,14 +696,14 @@ def status_method(*args): 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")) @@ -879,9 +879,9 @@ def filecmd(legend, hook, args): (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) @@ -902,7 +902,7 @@ def release_method(*args): 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): @@ -932,7 +932,7 @@ def fast_export_method(*args): 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: @@ -1045,7 +1045,7 @@ class RCS: 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: @@ -1065,7 +1065,7 @@ class RCS: # 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] @@ -1189,13 +1189,13 @@ class RCS: 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: -- 2.43.0