sapling/tests/test-phabdiff.t
Mateusz Kwapich afebcb5512 phabdiff: add singlepublicbase revset
Summary:
This revset will be used by jellyfish to set the proper base in sandcastle. Anyway: a public ancestor is
a valuable commit information so there should be a template for it.

Test Plan: see test

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: durham, quark, medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5275811

Tasks: 19186426

Signature: t1:5275811:1497979632:9589491be723daf0b127703a7bc4571f7539bd84
2017-06-21 17:03:50 +01:00

61 lines
1.6 KiB
Perl

$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ echo "[extensions]" >> $HGRCPATH
$ echo "phabdiff=" >> $HGRCPATH
Setup repo
$ hg init repo
$ cd repo
Test phabdiff template mapping
$ echo a > a
$ hg commit -Aqm "Differential Revision: https://phabricator.fb.com/D1234
> Task ID: 2312"
$ hg log --template "{phabdiff}\n"
D1234
$ echo c > c
$ hg commit -Aqm "Differential Revision: http://phabricator.intern.facebook.com/D1245
> Task ID: 2312"
$ hg log -r . --template "{phabdiff}\n"
D1245
$ echo b > b
$ hg commit -Aqm "Differential Revision: https://phabricator.fb.com/D5678
> Tasks:32, 44 55"
$ hg log -r . --template "{phabdiff}: {tasks}\n"
D5678: 32 44 55
$ echo d > d
$ hg commit -Aqm "Differential Revision: http://phabricator.intern.facebook.com/D1245
> Task: t123456,456"
$ hg log -r . --template "{phabdiff}: {tasks}\n"
D1245: 123456 456
Only match the Differential Revision label at the start of a line
$ echo e > e
$ hg commit -Aqm "Test Commit
> Test Plan: tested on Differential Revision: http://phabricator.intern.facebook.com/D1000
> Differential Revision: http://phabricator.intern.facebook.com/D6789
> "
$ hg log -r . --template "{phabdiff}\n"
D6789
Make sure the template keywords are documented correctly
$ hg help templates | egrep 'phabdiff|tasks'
phabdiff String. Return the phabricator diff id for a given hg rev.
tasks String. Return the tasks associated with given hg rev.
Check singlepublicbase
$ hg log -r . --template "{singlepublicbase}\n"
$ hg phase -p -r ::2
$ hg log -r . --template "{singlepublicbase}\n"
2480b7b497e0af879a40a0d4d960ceb748d27085