##// END OF EJS Templates
smartset: use native set operations as fast paths...
smartset: use native set operations as fast paths For set operations like "&" and "-", where we know both basesets have their sets ready, and the first set is sorted, use the native Python set operations as a fast path. Note: "+" is not optimized as that will break the ordering. This leads to noticeable improvements on performance: revset | before | after | delta ---------------------------------------------------------------- draft() & draft() & draft() & draft() | 776 | 477 | -39% draft() + draft() + draft() + draft() | 2849 | 2864 | draft() - draft() + draft() - draft() | 943 | 240 | -75% draft() - draft() - draft() - draft() | 557 | 197 | -64% (time measured in microseconds)

File last commit:

r30432:36334038 default
r31020:2d1bf840 default
Show More
test-mq-qfold.t
263 lines | 4.6 KiB | text/troff | Tads3Lexer
Yuya Nishihara
tests: write hgrc of more than two lines by using shell heredoc...
r23172 $ cat <<EOF >> $HGRCPATH
> [extensions]
> mq =
> [mq]
> git = keep
> [diff]
> nodates = 1
> EOF
Adrian Buehlmann
tests: unify some of test-mq*
r12324
init:
$ hg init repo
$ cd repo
$ echo a > a
$ hg ci -Am adda
adding a
$ echo a >> a
$ hg qnew -f p1
$ echo b >> a
$ hg qnew -f p2
$ echo c >> a
$ hg qnew -f p3
Fold in the middle of the queue:
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423 (this tests also that editor is not invoked if '--edit' is not
specified)
Adrian Buehlmann
tests: unify some of test-mq*
r12324
$ hg qpop p1
popping p3
popping p2
now at: p1
$ hg qdiff
diff -r 07f494440405 a
--- a/a
+++ b/a
@@ -1,1 +1,2 @@
a
+a
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423 $ HGEDITOR=cat hg qfold p2
Adrian Buehlmann
tests: unify some of test-mq*
r12324 $ grep git .hg/patches/p1 && echo 'git patch found!'
[1]
$ hg qser
p1
p3
$ hg qdiff
diff -r 07f494440405 a
--- a/a
+++ b/a
@@ -1,1 +1,3 @@
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 a
Mads Kiilerich
bdiff: give slight preference to longest matches in the middle of the B side...
r30431 +a
Adrian Buehlmann
tests: unify some of test-mq*
r12324 +b
Fold with local changes:
$ echo d >> a
$ hg qfold p3
timeless@mozdev.org
mq: consistently use qrefresh
r26780 abort: local changes found, qrefresh first
Adrian Buehlmann
tests: unify some of test-mq*
r12324 [255]
$ hg diff -c .
Brodie Rao
tests: add glob matching for unified tests...
r12376 diff -r 07f494440405 -r ???????????? a (glob)
Adrian Buehlmann
tests: unify some of test-mq*
r12324 --- a/a
+++ b/a
@@ -1,1 +1,3 @@
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 a
Mads Kiilerich
bdiff: give slight preference to longest matches in the middle of the B side...
r30431 +a
Adrian Buehlmann
tests: unify some of test-mq*
r12324 +b
$ hg revert -a --no-backup
reverting a
Fold git patch into a regular patch, expect git patch:
$ echo a >> a
$ hg qnew -f regular
$ hg cp a aa
$ hg qnew --git -f git
$ hg qpop
popping git
now at: regular
$ hg qfold git
$ cat .hg/patches/regular
# HG changeset patch
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent ???????????????????????????????????????? (glob)
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/a b/a
--- a/a
+++ b/a
@@ -1,3 +1,4 @@
a
a
b
+a
diff --git a/a b/aa
copy from a
copy to aa
--- a/a
+++ b/aa
@@ -1,3 +1,4 @@
a
a
b
+a
$ hg qpop
popping regular
now at: p1
$ hg qdel regular
Fold regular patch into a git patch, expect git patch:
$ hg cp a aa
$ hg qnew --git -f git
$ echo b >> aa
$ hg qnew -f regular
$ hg qpop
popping regular
now at: git
$ hg qfold regular
$ cat .hg/patches/git
# HG changeset patch
Mads Kiilerich
mq: write '# Parent ' lines with two spaces like export does (BC)...
r22521 # Parent ???????????????????????????????????????? (glob)
Adrian Buehlmann
tests: unify some of test-mq*
r12324
diff --git a/a b/aa
copy from a
copy to aa
--- a/a
+++ b/aa
@@ -1,3 +1,4 @@
a
a
b
+b
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 Test saving last-message.txt:
$ hg qrefresh -m "original message"
Sean Farley
tests: use TESTTMP instead of TESTDIR...
r20859 $ cat > $TESTTMP/commitfailure.py <<EOF
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > from mercurial import error
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 > def reposetup(ui, repo):
> class commitfailure(repo.__class__):
> def commit(self, *args, **kwargs):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > raise error.Abort('emulating unexpected abort')
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 > repo.__class__ = commitfailure
> EOF
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 $ cat >> .hg/hgrc <<EOF
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 > [extensions]
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 > # this failure occurs before editor invocation
Sean Farley
tests: use TESTTMP instead of TESTDIR...
r20859 > commitfailure = $TESTTMP/commitfailure.py
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 > EOF
Sean Farley
tests: use TESTTMP instead of TESTDIR...
r20859 $ cat > $TESTTMP/editor.sh << EOF
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 > echo "==== before editing"
> cat \$1
> echo "===="
> (echo; echo "test saving last-message.txt") >> \$1
> EOF
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 $ hg qapplied
p1
git
$ hg tip --template "{files}\n"
aa
FUJIWARA Katsunori
qfold: allow to specify '--message/'--logfile' and '--edit' at the same time...
r21714 (test that editor is not invoked before transaction starting,
and that combination of '--edit' and '--message' doesn't abort execution)
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 $ rm -f .hg/last-message.txt
FUJIWARA Katsunori
qfold: allow to specify '--message/'--logfile' and '--edit' at the same time...
r21714 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e -m MESSAGE p3
timeless@mozdev.org
mq: consistently use qrefresh
r26780 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 abort: emulating unexpected abort
[255]
Danek Duvall
tests: cat error messages are different on Solaris
r21930 $ test -f .hg/last-message.txt
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 [1]
(reset applied patches and directory status)
$ cat >> .hg/hgrc <<EOF
> [extensions]
> # this failure occurs after editor invocation
> commitfailure = !
> EOF
$ hg qapplied
p1
$ hg status -A aa
? aa
$ rm aa
$ hg status -m
M a
$ hg revert --no-backup -q a
$ hg qpush -q git
now at: git
(test that editor is invoked and commit message is saved into
"last-message.txt")
$ cat >> .hg/hgrc <<EOF
> [hooks]
> # this failure occurs after editor invocation
> pretxncommit.unexpectedabort = false
> EOF
$ rm -f .hg/last-message.txt
$ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
==== before editing
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 original message
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to use default message.
HG: --
HG: user: test
HG: branch 'default'
HG: added aa
HG: changed a
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 ====
Laurent Charignon
localrepo: put bookmark move following commit in one transaction...
r26998 note: commit message saved in .hg/last-message.txt
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 transaction abort!
rollback completed
timeless@mozdev.org
mq: consistently use qrefresh
r26780 qrefresh interrupted while patch was popped! (revert --all, qpush to recover)
FUJIWARA Katsunori
qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"...
r21236 abort: pretxncommit.unexpectedabort hook exited with status 1
[255]
$ cat .hg/last-message.txt
original message
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423
FUJIWARA Katsunori
qfold: save manually edited commit message into ".hg/last-message.txt"...
r20769 test saving last-message.txt
FUJIWARA Katsunori
mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)...
r21423 (confirm whether files listed up in the commit message editing are correct)
$ cat >> .hg/hgrc <<EOF
> [hooks]
> pretxncommit.unexpectedabort =
> EOF
$ hg status -u | while read f; do rm ${f}; done
$ hg revert --no-backup -q --all
$ hg qpush -q git
now at: git
$ hg qpush -q --move p3
now at: p3
$ hg status --rev "git^1" --rev . -arm
M a
A aa
Adrian Buehlmann
tests: unify some of test-mq*
r12324 $ cd ..