version="0.10"
-def screenwidth():
- "Return the current width of the terminal window."
- if pseudotime:
- return 79
- else:
- with popen_or_die(b'stty size', b"rb") as tp:
- return int(tp.read().split()[1])
-
def rfc3339(t):
"RFC3339 string from Unix time."
return time.strftime(b"%Y-%m-%dT%H:%M:%SZ", time.gmtime(t))
# Repo directory
repodir = ".src"
+# How to size cut lines. We used to do this dynamically from the screen size,
+# but that fails under Emacs
+WIDTH = 72
+
def stamp(arg):
"Name the stamp file used to track revisions."
if os.sep not in arg:
custom = args[0][2:]
args.pop(0)
ctx = CommandContext("list", args, default_to="branch_reversed")
- if custom is None:
- width = screenwidth()
for arg in ctx.args:
if ignore(arg) or not registered(arg):
continue
if custom is None:
- sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
+ sys.stdout.write("= %s %s\n" % (arg, ((WIDTH - len(arg) - 3) * "=")))
for item in ctx.resolve(History(arg), backwards=True):
# Must allow enough room for revno and date
if item.selected():
mark = "-"
summary = item.log.split('\n')[0]
if custom is None:
- summary = summary[:width - 34]
+ summary = summary[:WIDTH - 34]
sys.stdout.write("%-4d %s %s %s\n" \
% (item.revno, mark, item.date, summary))
else:
def log_method(*args):
"Report revision logs"
ctx = CommandContext("log", args, default_to="branch_reversed")
- width = screenwidth()
for arg in ctx.args:
if ignore(arg) or not registered(arg):
continue
- sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
+ sys.stdout.write("= %s %s\n" % (arg, ((WIDTH - len(arg) - 3) * "=")))
for item in ctx.resolve(History(arg), backwards=True):
sys.stdout.write("%-4d | %s\n%s" % (item.revno,item.date,item.log))
- sys.stdout.write(("-" * (width - 1)) + "\n")
+ sys.stdout.write(("-" * WIDTH) + "\n")
def checkout_method(*args):
"Refresh the working copy from the history file."
if args[0] in ("-l", "list"):
args.pop(0)
ctx = CommandContext(legend + " listing", args, require_empty=True)
- width = screenwidth()
for arg in ctx.args:
metadata = History(arg)
sys.stdout.write("= %s %s\n" \
- % (arg, ((width - len(arg) - 5) * "=")))
+ % (arg, ((WIDTH - len(arg) - 5) * "=")))
keys = metadata.symbols.keys()
if metadata.branch in keys:
keys.remove(metadata.branch)
check "content check after second commit"
cat >testfile2 <<EOF
-= testfile1 =================================================================
+= testfile1 ============================================================
2 * 1970-01-02T00:01:00Z Second comment
1 - 1970-01-02T00:00:00Z First comment
EOF
check "list test"
cat >testfile2 <<EOF
-= testfile1 =================================================================
+= testfile1 ============================================================
2 | 1970-01-02T00:01:00Z
Second comment
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
1 | 1970-01-02T00:00:00Z
First comment
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
EOF
src $TESTOPTS log testfile1 >testfile3
check "commit with -f"
cat >testfile4 <<EOF
-= testfile1 =================================================================
+= testfile1 ============================================================
3 | 1970-01-02T00:02:00Z
'Third' comment
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
2 | 1970-01-02T00:01:00Z
Second comment
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
1 | 1970-01-02T00:00:00Z
First comment
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
EOF
src $TESTOPTS log testfile1 >testfile5
check "3-commit log test"
cat >testfile6 <<EOF
-= testfile1 =================================================================
+= testfile1 ============================================================
src: testfile1 has no 5 revision
EOF
check "tag set to default tip revision"
cat >testfile8 <<EOF
-= testfile1 =================================================================
+= testfile1 ==========================================================
3 sampletag
EOF
src $TESTOPTS tag list >testfile9
check "tag set to revision 1"
cat >testfile10 <<EOF
-= testfile1 =================================================================
+= testfile1 ==========================================================
1 basetag
3 sampletag
EOF
check "tag deletion: sampletag"
cat >testfile12 <<EOF
-= testfile1 =================================================================
+= testfile1 ==========================================================
1 basetag
EOF
src $TESTOPTS tag >testfile13
EOF
cat >sample.seqlog <<EOF
-= sample ====================================================================
+= sample ===============================================================
6 | 1970-01-02T00:05:00Z
Still utterly fubar
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
5 | 1970-01-02T00:04:00Z
Totally unfubared.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
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
check "traversal by -"
cat >sample.branchlog <<EOF
-= sample ====================================================================
+= sample ===============================================================
6 | 1970-01-02T00:05:00Z
Still utterly fubar
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
5 | 1970-01-02T00:04:00Z
Totally unfubared.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
3 | 1970-01-02T00:02:00Z
Third comment.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
2 | 1970-01-02T00:01:00Z
Second comment.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
EOF
src $TESTOPTS log 2..6 sample >tryit
check "traversal by .."
cat >sample.taglog <<EOF
-= sample ====================================================================
+= sample ===============================================================
4 - 1970-01-02T00:03:00Z On a branch?
EOF
check "tag renaming"
cat >changes <<EOF
-= sample ====================================================================
+= sample =============================================================
8 GORP
4 GROTTY
EOF
check "tag list after rename"
cat >branchlist <<EOF
-= sample ====================================================================
+= sample =============================================================
0 trunk
3 muggle
8 sample
check "branch list content"
cat >branchlog <<EOF
-= sample ====================================================================
+= sample ===============================================================
4 - 1970-01-02T00:03:00Z On a branch?
EOF
check "branch delete"
cat >newlist <<EOF
-= sample ====================================================================
+= sample =============================================================
0 trunk
3 muggle
7 sample
check "branch list check after delete" delete
cat >newlog <<EOF
-= sample ====================================================================
+= sample ===============================================================
12 | 1970-01-02T00:11:00Z
I see you
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
11 | 1970-01-02T00:10:00Z
That's good.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
10 | 1970-01-02T00:09:00Z
No good.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
9 | 1970-01-02T00:08:00Z
It' all good.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
8 | 1970-01-02T00:07:00Z
All fixed up.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
7 | 1970-01-02T00:06:00Z
Utterly fubar
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
6 | 1970-01-02T00:05:00Z
Totally chenille.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
5 | 1970-01-02T00:04:00Z
Still utterly fubar
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
4 | 1970-01-02T00:03:00Z
Totally unfubared.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
3 | 1970-01-02T00:02:00Z
Third comment.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
2 | 1970-01-02T00:01:00Z
Second comment.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
1 | 1970-01-02T00:00:00Z
First comment.
-------------------------------------------------------------------------------
+------------------------------------------------------------------------
EOF
src $TESTOPTS log sample >tryit