##// END OF EJS Templates
identify: add template support...
identify: add template support This is based on a patch proposed last year by Mathias De Maré[1], with a few changes. - Tags and bookmarks are now formatted lists, for more flexible queries. - The templater is populated whether or not [-nibtB] is specified. (Plain output is unchanged.) This seems more consistent with other templated commands. - The 'id' property is a string, instead of a list. - The parents of 'wdir()' have their own list of attributes. I left 'id' as a string because it seems very useful for generating version info. It's also a bit strange because the value and meaning changes depending on whether or not --debug is passed (short vs full hash), whether the revision is a merge or not (one hash or two, separated by a '+'), the working directory or not (node vs p1node), and local or not (remote defaults to tip, and never has '+'). The equivalent string built with {rev} seems much less useful, and I couldn't think of a reasonable name, so I left it out. The discussion seemed to be pointing towards having a list of nodes, with more than one entry for a merge. It seems simpler to give the nodes a name, and use {node} for the actual commit probed, especially now that there is a virtual node for 'wdir()'. Yuya mentioned using fm.nested() in that thread, so I did for the parent nodes. I'm not sure if the plan is to fill in all of the context attributes in these items, or if these nested items should simply be made {p1node} and {p1rev}. I used ':' as the tag separator for consistency with {tags} in the log templater. Likewise, bookmarks are separated by a space for consistency with the corresponding log template. [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-August/087039.html

File last commit:

r23172:e955549c default
r33051:15a79ac8 default
Show More
test-mq-git.t
212 lines | 3.6 KiB | text/troff | Tads3Lexer
Adrian Buehlmann
tests: unify some of test-mq*
r12324 # Test the plumbing of mq.git option
# Automatic upgrade itself is tested elsewhere.
Yuya Nishihara
tests: write hgrc of more than two lines by using shell heredoc...
r23172 $ cat <<EOF >> $HGRCPATH
> [extensions]
> mq =
> [diff]
> nodates = 1
> EOF
Adrian Buehlmann
tests: unify some of test-mq*
r12324
$ hg init repo-auto
$ cd repo-auto
git=auto: regular patch creation:
$ echo a > a
$ hg add a
$ hg qnew -d '0 0' -f adda
$ cat .hg/patches/adda
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent 0000000000000000000000000000000000000000
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff -r 000000000000 -r ef8dafc9fa4c a
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+a
git=auto: git patch creation with copy:
$ hg cp a b
$ hg qnew -d '0 0' -f copy
$ cat .hg/patches/copy
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/a b/b
copy from a
copy to b
git=auto: git patch when using --git:
$ echo regular > regular
$ hg add regular
$ hg qnew -d '0 0' --git -f git
$ cat .hg/patches/git
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/regular b/regular
new file mode 100644
--- /dev/null
+++ b/regular
@@ -0,0 +1,1 @@
+regular
git=auto: regular patch after qrefresh without --git:
$ hg qrefresh -d '0 0'
$ cat .hg/patches/git
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff -r 99586d5f048c regular
--- /dev/null
+++ b/regular
@@ -0,0 +1,1 @@
+regular
$ cd ..
$ hg init repo-keep
$ cd repo-keep
$ echo '[mq]' > .hg/hgrc
$ echo 'git = KEEP' >> .hg/hgrc
git=keep: git patch with --git:
$ echo a > a
$ hg add a
$ hg qnew -d '0 0' -f --git git
$ cat .hg/patches/git
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent 0000000000000000000000000000000000000000
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+a
git=keep: git patch after qrefresh without --git:
$ echo a >> a
$ hg qrefresh -d '0 0'
$ cat .hg/patches/git
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent 0000000000000000000000000000000000000000
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,2 @@
+a
+a
$ cd ..
$ hg init repo-yes
$ cd repo-yes
$ echo '[mq]' > .hg/hgrc
$ echo 'git = yes' >> .hg/hgrc
git=yes: git patch:
$ echo a > a
$ hg add a
$ hg qnew -d '0 0' -f git
$ cat .hg/patches/git
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent 0000000000000000000000000000000000000000
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+a
git=yes: git patch after qrefresh:
$ echo a >> a
$ hg qrefresh -d '0 0'
$ cat .hg/patches/git
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent 0000000000000000000000000000000000000000
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,2 @@
+a
+a
$ cd ..
$ hg init repo-no
$ cd repo-no
$ echo '[diff]' > .hg/hgrc
$ echo 'git = True' >> .hg/hgrc
$ echo '[mq]' > .hg/hgrc
$ echo 'git = False' >> .hg/hgrc
git=no: regular patch with copy:
$ echo a > a
$ hg add a
$ hg qnew -d '0 0' -f adda
$ hg cp a b
$ hg qnew -d '0 0' -f regular
$ cat .hg/patches/regular
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff -r ef8dafc9fa4c -r a70404f79ba3 b
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
+a
git=no: regular patch after qrefresh with copy:
$ hg cp a c
$ hg qrefresh -d '0 0'
$ cat .hg/patches/regular
# HG changeset patch
Mads Kiilerich
mq: write headers for new HG patches in the same order as export (BC)
r22520 # Date 0 0
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff -r ef8dafc9fa4c b
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
+a
diff -r ef8dafc9fa4c c
--- /dev/null
+++ b/c
@@ -0,0 +1,1 @@
+a
$ cd ..