##// END OF EJS Templates
mq: add parent node IDs to MQ patches on qrefresh/qnew...
mq: add parent node IDs to MQ patches on qrefresh/qnew The goal of this patch is to add the IDs of the parents of applied MQ patches into the patch file headers whenever qnew or qrefresh are run. This will serve as a reminder of when the patches last applied cleanly and will let us do more intelligent things in the future, such as: * Resolve conflicts found when qpushing to a new location by merging instead of simply showing rejects. * Display better diffs of versioned MQ patches because we can tell how the patched files have changed in the meantime. Here are the new rules this patch introduces. They are checked in this order: * If a patch currently has old, plain-style patch headers ("From:" and "Date:") do not change the style or add any new headers. * If the 'mq.plain' configuration setting is true, only plain-style headers will be used for all MQ patches. * qnew will initialize new patches with HG-style headers and fill in the "# Parent" header with the appropriate parent node. * qrefresh will refresh the "# Parent" header with the current parent of the current patch.

File last commit:

r10397:8cb81d75 default
r10397:8cb81d75 default
Show More
test-mq-qnew
102 lines | 1.6 KiB | text/plain | TextLexer
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296 #!/bin/sh
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 catpatch() {
cat $1 | sed -e "s/^\(# Parent \).*/\1/"
}
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296 echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 runtest() {
hg init mq
cd mq
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo a > a
hg ci -Ama
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '% qnew should refuse bad patch names'
hg qnew series
hg qnew status
hg qnew guards
hg qnew .hgignore
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 hg qinit -c
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '% qnew with uncommitted changes'
echo a > somefile
hg add somefile
hg qnew uncommitted.patch
hg st
hg qseries
echo '% qnew implies add'
hg -R .hg/patches st
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '% qnew missing'
hg qnew missing.patch missing
echo '% qnew -m'
hg qnew -m 'foo bar' mtest.patch
catpatch .hg/patches/mtest.patch
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '% qnew twice'
hg qnew first.patch
hg qnew first.patch
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 touch ../first.patch
hg qimport ../first.patch
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '% qnew -f from a subdirectory'
hg qpop -a
mkdir d
cd d
echo b > b
hg ci -Am t
echo b >> b
hg st
hg qnew -g -f p
catpatch ../.hg/patches/p
Brendan Cully
mq: put qnew tests into own file, fold in qnew-twice
r7296
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '% qnew -u with no username configured'
HGUSER= hg qnew -u blue red
catpatch ../.hg/patches/red
Martin Geisler
mq: do not call ui.username unless it is necessary...
r9733
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '% fail when trying to import a merge'
hg init merge
cd merge
touch a
hg ci -Am null
echo a >> a
hg ci -m a
hg up -r 0
echo b >> a
hg ci -m b
hg merge -f 1
hg resolve --mark a
hg qnew -f merge
cd ../../..
rm -r mq
}
timeless
mq: qnew -f should reject merge working directories
r10114
Steve Losh
mq: add parent node IDs to MQ patches on qrefresh/qnew...
r10397 echo '%%% plain headers'
echo "[mq]" >> $HGRCPATH
echo "plain=true" >> $HGRCPATH
mkdir sandbox
(cd sandbox ; runtest)
rm -r sandbox
echo '%%% hg headers'
echo "plain=false" >> $HGRCPATH
mkdir sandbox
(cd sandbox ; runtest)
rm -r sandbox
timeless
mq: qnew -f should reject merge working directories
r10114
exit 0