author | Martin Geisler <mg@lazybytes.net> |
Sat, 14 Aug 2010 02:22:10 +0200 | |
changeset 11853 | afe19a1bf9d3 |
parent 10397 | 8cb81d75730c |
permissions | -rwxr-xr-x |
8426 | 1 |
#!/bin/sh |
2 |
||
3 |
echo "[extensions]" >> $HGRCPATH |
|
4 |
echo "mq=" >> $HGRCPATH |
|
10190
9c2c94934f0d
mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents:
10186
diff
changeset
|
5 |
echo "[mq]" >> $HGRCPATH |
9c2c94934f0d
mq: upgrade to git patch when necessary (issue767)
Patrick Mezard <pmezard@gmail.com>
parents:
10186
diff
changeset
|
6 |
echo "git=keep" >> $HGRCPATH |
8426 | 7 |
|
8 |
filterdiff() |
|
9 |
{ |
|
10 |
grep -v diff | \ |
|
11 |
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ |
|
12 |
-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" |
|
13 |
} |
|
14 |
||
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10190
diff
changeset
|
15 |
filterpatch() |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10190
diff
changeset
|
16 |
{ |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10190
diff
changeset
|
17 |
sed -e "s/\(# Parent \).*/\1/" |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10190
diff
changeset
|
18 |
} |
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10190
diff
changeset
|
19 |
|
8426 | 20 |
echo '% init' |
21 |
hg init repo |
|
22 |
cd repo |
|
23 |
echo a > a |
|
24 |
hg ci -Am adda |
|
25 |
echo a >> a |
|
26 |
hg qnew -f p1 |
|
27 |
echo b >> a |
|
28 |
hg qnew -f p2 |
|
29 |
echo c >> a |
|
30 |
hg qnew -f p3 |
|
31 |
echo '% fold in the middle of the queue' |
|
32 |
hg qpop p1 |
|
33 |
hg qdiff | filterdiff |
|
34 |
hg qfold p2 |
|
10186
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
35 |
grep git .hg/patches/p1 && echo 'git patch found!' |
8426 | 36 |
hg qser |
37 |
hg qdiff | filterdiff |
|
38 |
echo '% fold with local changes' |
|
39 |
echo d >> a |
|
40 |
hg qfold p3 |
|
41 |
hg diff -c . | filterdiff |
|
10186
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
42 |
hg revert -a --no-backup |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
43 |
|
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
44 |
echo '% fold git patch into a regular patch, expect git patch' |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
45 |
echo a >> a |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
46 |
hg qnew -f regular |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
47 |
hg cp a aa |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
48 |
hg qnew --git -f git |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
49 |
hg qpop |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
50 |
hg qfold git |
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10190
diff
changeset
|
51 |
cat .hg/patches/regular | filterpatch |
10186
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
52 |
hg qpop |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
53 |
hg qdel regular |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
54 |
|
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
55 |
echo '% fold regular patch into a git patch, expect git patch' |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
56 |
hg cp a aa |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
57 |
hg qnew --git -f git |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
58 |
echo b >> aa |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
59 |
hg qnew -f regular |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
60 |
hg qpop |
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
61 |
hg qfold regular |
10397
8cb81d75730c
mq: add parent node IDs to MQ patches on qrefresh/qnew
Steve Losh <steve@stevelosh.com>
parents:
10190
diff
changeset
|
62 |
cat .hg/patches/git | filterpatch |
10186
296a0b14a686
mq: preserve --git flag when folding patches
Patrick Mezard <pmezard@gmail.com>
parents:
8426
diff
changeset
|
63 |
|
8426 | 64 |
cd .. |
65 |
||
66 |