mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
eea597d740
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.
63 lines
1.1 KiB
Bash
Executable File
63 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Test that qpush cleans things up if it doesn't complete
|
|
|
|
echo "[extensions]" >> $HGRCPATH
|
|
echo "mq=" >> $HGRCPATH
|
|
|
|
hg init repo
|
|
cd repo
|
|
|
|
echo foo > foo
|
|
hg ci -Am 'add foo'
|
|
|
|
touch untracked-file
|
|
echo 'syntax: glob' > .hgignore
|
|
echo '.hgignore' >> .hgignore
|
|
|
|
hg qinit
|
|
|
|
echo '% test qpush on empty series'
|
|
hg qpush
|
|
|
|
hg qnew patch1
|
|
echo >> foo
|
|
hg qrefresh -m 'patch 1'
|
|
|
|
hg qnew patch2
|
|
echo bar > bar
|
|
hg add bar
|
|
hg qrefresh -m 'patch 2'
|
|
|
|
hg qnew --config 'mq.plain=true' bad-patch
|
|
echo >> foo
|
|
hg qrefresh
|
|
|
|
hg qpop -a
|
|
|
|
python -c 'print "\xe9"' > message
|
|
cat .hg/patches/bad-patch >> message
|
|
mv message .hg/patches/bad-patch
|
|
|
|
hg qpush -a && echo 'qpush succeded?!'
|
|
|
|
hg parents
|
|
|
|
echo '% bar should be gone; other unknown/ignored files should still be around'
|
|
hg status -A
|
|
|
|
echo '% preparing qpush of a missing patch'
|
|
hg qpop -a
|
|
hg qpush
|
|
rm .hg/patches/patch2
|
|
echo '% now we expect the push to fail, but it should NOT complain about patch1'
|
|
hg qpush
|
|
|
|
echo '% preparing qpush of missing patch with no patch applied'
|
|
hg qpop -a
|
|
rm .hg/patches/patch1
|
|
echo '% qpush should fail the same way as below'
|
|
hg qpush
|
|
|
|
true # happy ending
|