` src project news
Repository head:
+ Branch-sensitive traversal with .. is working.
Fixed yet another fast-export bug.
0.5: 2014-11-11
SRC TODO list
-* branch-restricted ranges in revision specifications.
-
* tag and branch names as revision-spec parts
* revert? reset?
"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 separated by"-" or "..". Unless otherwise noted under
-individual commands, the default revision is the tip revision on the
-current branch and the default range is all revisions on the current
-branch.
+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).
+
+Unless otherwise noted under individual commands, the default revision
+is the tip revision on the current branch and the default range is all
+revisions on the current branch.
The token "--" tells the command-line interpreter that revision-specs
and subcommands are done - everything after it is a filename, even
if self.seq is None:
croak("revision spec hasn't been resolved")
return i in self.seq
- def resolve(self, metadata):
+ def resolve(self, metadata, reversed=True):
"Resolve a revision spec that may contain tags into revnos."
if self.is_empty():
if self.default_to == "branch":
sys.stderr.write("selection: %s, branchwise is %s\n" % (self.seq, "on" if self.branchwise else "off"))
for item in metadata.revlist:
sys.stdout.write("%s\t%s\t%s\n" % (item.revno, item.date, item.revision))
+ # Because in the branchwise case the seqence is generated in reverse
+ if reversed != self.branchwise:
+ self.seq.reverse()
return [metadata.by_revno(s) for s in self.seq]
class CommentContext:
width = screenwidth()
for arg in ctx.args:
sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
- for item in ctx.resolve(History(arg)):
+ for item in ctx.resolve(History(arg), reversed=True):
# Must allow enough room for revno and date
summary = item.log.strip()[:width - 34]
if item.selected():
width = screenwidth()
for arg in ctx.args:
sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
- for item in ctx.resolve(History(arg)):
+ for item in ctx.resolve(History(arg), reversed=True):
sys.stdout.write("%-4d | %s\n%s" % (item.revno,item.date,item.log))
sys.stdout.write(("-" * (width - 1)) + "\n")
== 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 separated by "-" or "..". Unless otherwise noted under
-individual commands, the default revision is the tip revision on the
-current branch and the default range is all revisions on the current
-branch.
+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).
+
+Unless otherwise noted under individual commands, the default revision
+is the tip revision on the current branch and the default range is all
+revisions on the current branch.
The token "--" tells the command-line interpreter that revision-specs
and subcommands are done - everything after it is a filename, even
3 sampletag
EOF
src $TESTOPTS tag >testfile9
-diff testfile8 testfile9
+diff -u testfile8 testfile9
check "tag list check"
src $TESTOPTS tag basetag 1
3 sampletag
EOF
src $TESTOPTS tag >testfile11
-diff testfile10 testfile11
+diff -u testfile10 testfile11
check "second tag list check"
src $TESTOPTS tag delete sampletag
1 basetag
EOF
src $TESTOPTS tag >testfile13
-diff testfile12 testfile13
+diff -u testfile12 testfile13
check "tag list check after deletion"
# Alas, we have to do this or the fast-export regression will fail.
src $TESTOPTS list 3 newname1 | grep "Amended comment" >/dev/null
check "amended comment content"
+# Introduce a test history with some branchiness, so
+# we can test traversal across branch joins.
+cat >.src/sample,v <<EOF
+head 1.4;
+branch 1.3.1.4.1;
+access;
+symbols
+ sample:1.3.1.4.0.1
+ muggle:1.3.0.1;
+locks
+ esr:1.3.1.4;
+comment @# @;
+expand @b@;
+
+
+1.4
+date 2014.11.11.03.26.53; author esr; state Exp;
+branches;
+next 1.3;
+
+1.3
+date 2014.11.10.23.48.49; author esr; state Exp;
+branches
+ 1.3.1.1;
+next 1.2;
+
+1.2
+date 2014.11.10.23.48.11; author esr; state Exp;
+branches;
+next 1.1;
+
+1.1
+date 2014.11.10.23.47.08; author esr; state Exp;
+branches;
+next ;
+
+1.3.1.1
+date 2014.11.11.04.23.47; author esr; state Exp;
+branches;
+next 1.3.1.2;
+
+1.3.1.2
+date 2014.11.11.06.39.47; author esr; state Exp;
+branches;
+next 1.3.1.3;
+
+1.3.1.3
+date 2014.11.11.06.48.00; author esr; state Exp;
+branches;
+next 1.3.1.4;
+
+1.3.1.4
+date 2014.11.12.03.36.45; author esr; state Exp;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1.4
+log
+@On a branch?
+@
+text
+@Now is the time
+For all good men.
+To come to the aid of foo.
+This should be branch text.
+@
+
+
+1.3
+log
+@Third comment.
+@
+text
+@d4 1
+@
+
+
+1.3.1.1
+log
+@On a branch 2?
+@
+text
+@a3 2
+
+Again, this should be branch text.
+@
+
+
+1.3.1.2
+log
+@Let's see if this commend has a sepaeator before it.
+@
+text
+@d5 1
+a5 1
+Yet again, this should be branch text.
+@
+
+
+1.3.1.3
+log
+@Totally chenille.
+@
+text
+@a5 2
+
+Revision 7.
+@
+
+
+1.3.1.4
+log
+@foo-bar
+@
+text
+@d4 4
+a7 2
+This should be branch text.
+Try a comment with a hyphen.
+@
+
+
+1.2
+log
+@Second comment.
+@
+text
+@d3 1
+@
+
+
+1.1
+log
+@First comment.
+@
+text
+@d2 1
+@
+
+EOF
+
+cat >sample.seqlog <<EOF
+= sample ====================================================================
+6 | 1970-01-02T00:05:00Z
+Let's see if this commend has a sepaeator before it.
+------------------------------------------------------------------------------
+5 | 1970-01-02T00:04:00Z
+On a branch 2?
+------------------------------------------------------------------------------
+4 | 1970-01-02T00:03:00Z
+On a branch?
+------------------------------------------------------------------------------
+3 | 1970-01-02T00:02:00Z
+Third comment.
+------------------------------------------------------------------------------
+2 | 1970-01-02T00:01:00Z
+Second comment.
+------------------------------------------------------------------------------
+EOF
+
+src $TESTOPTS log 2-6 sample >tryit
+diff -u tryit sample.seqlog
+check "traversal by -"
+
+cat >sample.branchlog <<EOF
+= sample ====================================================================
+6 | 1970-01-02T00:05:00Z
+Let's see if this commend has a sepaeator before it.
+------------------------------------------------------------------------------
+5 | 1970-01-02T00:04:00Z
+On a branch 2?
+------------------------------------------------------------------------------
+3 | 1970-01-02T00:02:00Z
+Third comment.
+------------------------------------------------------------------------------
+2 | 1970-01-02T00:01:00Z
+Second comment.
+------------------------------------------------------------------------------
+EOF
+
+src $TESTOPTS log 2..6 sample >tryit
+diff -u tryit sample.branchlog
+check "traversal by .."
+
+
rm -fr $SANDBOX
# end