author | Matt Mackall <mpm@selenic.com> |
Wed, 28 Apr 2010 13:45:21 -0500 | |
branch | stable |
changeset 11031 | 409c0e4d79e9 |
parent 10589 | 92b8c79b34c2 |
child 11513 | 0c944b7af564 |
permissions | -rwxr-xr-x |
2711
ca97be5babf8
mq: do not allow to qnew a patch twice
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
1 |
#!/bin/sh |
ca97be5babf8
mq: do not allow to qnew a patch twice
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
3 |
catpatch() { |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
4 |
cat $1 | sed -e "s/^\(# Parent \).*/\1/" |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
5 |
} |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
6 |
|
2990
61fcd9fac434
Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2714
diff
changeset
|
7 |
echo "[extensions]" >> $HGRCPATH |
61fcd9fac434
Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2714
diff
changeset
|
8 |
echo "mq=" >> $HGRCPATH |
2711
ca97be5babf8
mq: do not allow to qnew a patch twice
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
9 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
10 |
runtest() { |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
11 |
hg init mq |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
12 |
cd mq |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
13 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
14 |
echo a > a |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
15 |
hg ci -Ama |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
16 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
17 |
echo '% qnew should refuse bad patch names' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
18 |
hg qnew series |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
19 |
hg qnew status |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
20 |
hg qnew guards |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
21 |
hg qnew .hgignore |
10588
b0b19d61d79a
mq: disallow # (and : on Windows) in patch names (issue2065)
Sune Foldager <cryo@cyanite.org>
parents:
10397
diff
changeset
|
22 |
hg qnew .mqfoo |
b0b19d61d79a
mq: disallow # (and : on Windows) in patch names (issue2065)
Sune Foldager <cryo@cyanite.org>
parents:
10397
diff
changeset
|
23 |
hg qnew 'foo#bar' |
10589
92b8c79b34c2
mq: disallow : in patch names (issue2065)
Sune Foldager <cryo@cyanite.org>
parents:
10588
diff
changeset
|
24 |
hg qnew 'foo:bar' |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
25 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
26 |
hg qinit -c |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
27 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
28 |
echo '% qnew with uncommitted changes' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
29 |
echo a > somefile |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
30 |
hg add somefile |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
31 |
hg qnew uncommitted.patch |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
32 |
hg st |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
33 |
hg qseries |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
34 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
35 |
echo '% qnew implies add' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
36 |
hg -R .hg/patches st |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
37 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
38 |
echo '% qnew missing' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
39 |
hg qnew missing.patch missing |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
40 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
41 |
echo '% qnew -m' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
42 |
hg qnew -m 'foo bar' mtest.patch |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
43 |
catpatch .hg/patches/mtest.patch |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
44 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
45 |
echo '% qnew twice' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
46 |
hg qnew first.patch |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
47 |
hg qnew first.patch |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
48 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
49 |
touch ../first.patch |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
50 |
hg qimport ../first.patch |
7296
695383442347
mq: put qnew tests into own file, fold in qnew-twice
Brendan Cully <brendan@kublai.com>
parents:
2990
diff
changeset
|
51 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
52 |
echo '% qnew -f from a subdirectory' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
53 |
hg qpop -a |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
54 |
mkdir d |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
55 |
cd d |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
56 |
echo b > b |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
57 |
hg ci -Am t |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
58 |
echo b >> b |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
59 |
hg st |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
60 |
hg qnew -g -f p |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
61 |
catpatch ../.hg/patches/p |
2714
85070b784896
Fix test-mq-qnew-twice exit code and output.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2711
diff
changeset
|
62 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
63 |
echo '% qnew -u with no username configured' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
64 |
HGUSER= hg qnew -u blue red |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
65 |
catpatch ../.hg/patches/red |
9733
f16ec85f125c
mq: do not call ui.username unless it is necessary
Martin Geisler <mg@lazybytes.net>
parents:
7297
diff
changeset
|
66 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
67 |
echo '% fail when trying to import a merge' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
68 |
hg init merge |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
69 |
cd merge |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
70 |
touch a |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
71 |
hg ci -Am null |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
72 |
echo a >> a |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
73 |
hg ci -m a |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
74 |
hg up -r 0 |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
75 |
echo b >> a |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
76 |
hg ci -m b |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
77 |
hg merge -f 1 |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
78 |
hg resolve --mark a |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
79 |
hg qnew -f merge |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
80 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
81 |
cd ../../.. |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
82 |
rm -r mq |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
83 |
} |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
84 |
|
10114
3e7663b2f3fc
mq: qnew -f should reject merge working directories
timeless <timeless@mozdev.org>
parents:
9733
diff
changeset
|
85 |
|
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
86 |
echo '%%% plain headers' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
87 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
88 |
echo "[mq]" >> $HGRCPATH |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
89 |
echo "plain=true" >> $HGRCPATH |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
90 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
91 |
mkdir sandbox |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
92 |
(cd sandbox ; runtest) |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
93 |
rm -r sandbox |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
94 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
95 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
96 |
echo '%%% hg headers' |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
97 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
98 |
echo "plain=false" >> $HGRCPATH |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
99 |
|
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
100 |
mkdir sandbox |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
101 |
(cd sandbox ; runtest) |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
102 |
rm -r sandbox |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10372
diff
changeset
|
103 |
|
10114
3e7663b2f3fc
mq: qnew -f should reject merge working directories
timeless <timeless@mozdev.org>
parents:
9733
diff
changeset
|
104 |
|
3e7663b2f3fc
mq: qnew -f should reject merge working directories
timeless <timeless@mozdev.org>
parents:
9733
diff
changeset
|
105 |
exit 0 |