From b5322ed352acdd57251ad0b2cbaa065e69ab6edf Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 13 Nov 2014 06:59:01 -0500 Subject: [PATCH] Move a method. --- src | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src b/src index 4d96f8d..be47fe1 100755 --- a/src +++ b/src @@ -27,7 +27,10 @@ # modtimes. # # This code uses magic tags with a 0 in the second-to-last slot to designate -# branches. It's the same format as CVS sticky tags. +# branches. It's the same format as CVS sticky tags, for the same reason. +# They need to be distinguishable from regular tags pointing at revisions, +# and this way the code to transform the sticky tag into the branch name is +# as simple as possible. # # Top of the list of things that people will bikeshed about is the # letter codes returned by src status. Different VCSes have @@ -237,9 +240,6 @@ class History: if item.revno == revno: return item.revision croak("{0} has no revno {1}".format(self.name, revno)) - def isbranch(self, symbol): - "Is this a branch symbol?" - return "0." in symbol def help_method(*_args): "Summarize src commands, or (with argument) show help for a single command." @@ -457,7 +457,7 @@ class CommandContext: croak("in {0}, can't resolve symbol {0}".format(metadata.name,token)) else: part = metadata.symbols[part] - if metadata.isbranch(part): + if backend.isbranch(part): part = backend.branch_to_tip(part) return metadata.native_to_revno(part) croak("internal error: in %s, failed to resolve %s" % (metadata.name, token)) @@ -798,7 +798,7 @@ def tag_helper(args, legend, validation_hook, delete_method, set_method): display = metadata.native_to_revno(display) else: display = metadata.native_to_revno(value) - if metadata.isbranch(value) == (legend == "branch"): + if backend.isbranch(value) == (legend == "branch"): sys.stdout.write("%4s\t%s\n" % (display,key)) return if args[0] in ("-r", "rename"): @@ -1081,6 +1081,9 @@ class RCS: n = self.splitrev(rev) n[-1] += 1 return self.joinrev(n) + def isbranch(self, symbol): + "Is this a branch symbol?" + return "0." in symbol def branch_to_base(self, revid): "Go from a branch ID sticky tag to the revision it was based on." # Must return an emptry string for the fake root sticky tag. @@ -1193,7 +1196,7 @@ class RCS: # Undocumented fact about RCS: The branch "1" is # the same as the blank branch. Significant because # you can't reset to the blank branch using rcs -b, - # that resets to the dynamically hhighest branch. + # that resets to the dynamically highest branch. if not branch or branch == "1": metadata.branch = "trunk" elif line.startswith("----------------------------"): -- 2.43.0