sapling/tests/test-smartlog.t
Eric Sumner 1c0fd006c9 smartlog: add revset function
Summary:
I wanted a way to see a commit in relation to the other smartlog entries, so
I refactored smartlog to provide a revset function for its default selections.

Test Plan: ##run-tests##

Reviewers: durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1794762

Tasks: 6057467

Signature: t1:1794762:1421888058:9b96d26f68b9b3bac24ef43db58fe8aa0299de37
2015-01-21 12:20:33 -08:00

102 lines
2.2 KiB
Raku

$ cat >> $HGRCPATH <<EOF
> [extensions]
> smartlog = $TESTDIR/../smartlog.py
> EOF
Build up a repo
$ hg init repo
$ cd repo
$ hg book master
$ touch a1 && hg add a1 && hg ci -ma1
$ touch a2 && hg add a2 && hg ci -ma2
$ hg book feature1
$ touch b && hg add b && hg ci -mb
$ hg up -q master
$ touch c1 && hg add c1 && hg ci -mc1
created new head
$ touch c2 && hg add c2 && hg ci -mc2
$ hg book feature2
$ touch d && hg add d && hg ci -md
$ hg log -G -T compact
@ 5[tip][feature2] db92053d5c83 1970-01-01 00:00 +0000 test
| d
|
o 4[master] 38d85b506754 1970-01-01 00:00 +0000 test
| c2
|
o 3:1 ec7553f7b382 1970-01-01 00:00 +0000 test
| c1
|
| o 2[feature1] 49cdb4091aca 1970-01-01 00:00 +0000 test
|/ b
|
o 1 b68836a6e2ca 1970-01-01 00:00 +0000 test
| a2
|
o 0 df4fd610a3d6 1970-01-01 00:00 +0000 test
a1
Basic test
$ hg smartlog -T compact
@ 5[tip][feature2] db92053d5c83 1970-01-01 00:00 +0000 test
| d
|
o 4[master] 38d85b506754 1970-01-01 00:00 +0000 test
| c2
|
.
.
|
| o 2[feature1] 49cdb4091aca 1970-01-01 00:00 +0000 test
|/ b
|
o 1 b68836a6e2ca 1970-01-01 00:00 +0000 test
| a2
|
As a revset
$ hg log -G -T compact -r 'smartlog()'
@ 5[tip][feature2] db92053d5c83 1970-01-01 00:00 +0000 test
| d
|
o 4[master] 38d85b506754 1970-01-01 00:00 +0000 test
| c2
|
| o 2[feature1] 49cdb4091aca 1970-01-01 00:00 +0000 test
| | b
| |
Specific revs
$ hg smartlog -T compact -r 2 -r 4
o 4[master] 38d85b506754 1970-01-01 00:00 +0000 test
| c2
|
.
.
|
| o 2[feature1] 49cdb4091aca 1970-01-01 00:00 +0000 test
|/ b
|
o 1 b68836a6e2ca 1970-01-01 00:00 +0000 test
| a2
|
$ hg smartlog -T compact -r 'smartlog()' -r 0
@ 5[tip][feature2] db92053d5c83 1970-01-01 00:00 +0000 test
| d
|
o 4[master] 38d85b506754 1970-01-01 00:00 +0000 test
| c2
|
| o 2[feature1] 49cdb4091aca 1970-01-01 00:00 +0000 test
|/ b
|
.
.
|
o 0 df4fd610a3d6 1970-01-01 00:00 +0000 test
a1