"Summarize src commands, or (with argument) show help for a single command."
print("""
A 'revision' is a 1-origin integer, or a tag name designating an
-integer revision. A revision range is a single revision, or a pair of
-revisions M-N (all revisions numerically from M to N) or M..N (all
-revisions that are branch ancestots of N and branch successors of M).
+integer revision, or a branch name esignatingthe tip revision of its
+branch. Revision numbers always increase in commit-date order.
+
+A revision range is a single revision, or a pair of revisions M-N (all
+revisions numerically from M to N) or M..N (all revisions that are
+branch ancestors of N and branch successors of M).
+
If src complains that your revision spec looks like a nonexistent
filename, you can prefix it with @ (this is always allowed).
else:
part = metadata.symbols[part]
if backend.isbranch(part):
- part = backend.branch_to_tip(part)
+ part = backend.branch_to_tip(part, metadata)
return metadata.native_to_revno(part)
self.start = subresolve(self.start)
self.end = subresolve(self.end)
return rev
def succ(self, rev):
"Our successor."
- n = self.splitrev(rev)
- n[-1] += 1
- return self.joinrev(n)
+ if rev:
+ n = self.splitrev(rev)
+ n[-1] += 1
+ return self.joinrev(n)
+ else:
+ return "1.1"
def isbranch(self, symbol):
"Is this a branch symbol?"
return "0." in symbol
"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.
return self.joinrev(self.splitrev(revid)[:-2])
- def branch_to_tip(self, revid):
+ def branch_to_tip(self, revid, metadata):
"Go from a branch ID sticky tag to the tip revision of its base."
- croak("branch_to_tip() is not yet implemented")
+ rev = self.branch_to_base(revid)
+ if rev:
+ rev += ".1.1"
+ else:
+ rev = "1.1"
+ while True:
+ nxt = self.succ(rev)
+ if metadata.native_to_revno(nxt) is None:
+ return rev
+ else:
+ rev = nxt
+ croak("internal error: couldn't find branch tip of %s" % rev)
def add(self, arg):
"Register a file"
# Key choices here: -b suppresses all keyword expansion, -U sets
== COMMAND SUMMARY ==
A 'revision' is a 1-origin integer, or a tag name designating an
-integer revision. A revision range is a single revision, or a pair of
-revisions M-N (all revisions numerically from M to N) or M..N (all
-revisions that are branch ancestors of N and branch successors of M).
+integer revision, or a branch name esignatingthe tip revision of its
+branch. Revision numbers always increase in commit-date order.
+
+A revision range is a single revision, or a pair of revisions M-N (all
+revisions numerically from M to N) or M..N (all revisions that are
+branch ancestors of N and branch successors of M).
+
If src complains that your revision spec looks like a nonexistent
filename, you can prefix it with @ (this is always allowed).