test-patch.t
105 lines
| 2.6 KiB
| text/troff
|
Tads3Lexer
/ tests / test-patch.t
Nicolas Dumazet
|
r11784 | $ cat > patchtool.py <<EOF | ||
Augie Fackler
|
r33974 | > from __future__ import absolute_import, print_function | ||
Nicolas Dumazet
|
r11784 | > import sys | ||
Augie Fackler
|
r33974 | > print('Using custom patch') | ||
Nicolas Dumazet
|
r11784 | > if '--binary' in sys.argv: | ||
Augie Fackler
|
r33974 | > print('--binary found !') | ||
Nicolas Dumazet
|
r11784 | > EOF | ||
$ echo "[ui]" >> $HGRCPATH | ||||
Augie Fackler
|
r32940 | $ echo "patch=$PYTHON ../patchtool.py" >> $HGRCPATH | ||
Nicolas Dumazet
|
r11784 | |||
$ hg init a | ||||
$ cd a | ||||
$ echo a > a | ||||
$ hg commit -Ama -d '1 0' | ||||
adding a | ||||
$ echo b >> a | ||||
$ hg commit -Amb -d '2 0' | ||||
$ cd .. | ||||
Christian Ebert
|
r11815 | This test checks that: | ||
- custom patch commands with arguments actually work | ||||
Nicolas Dumazet
|
r11784 | - patch code does not try to add weird arguments like | ||
--binary when custom patch commands are used. For instance | ||||
--binary is added by default under win32. | ||||
check custom patch options are honored | ||||
$ hg --cwd a export -o ../a.diff tip | ||||
$ hg clone -r 0 a b | ||||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
added 1 changesets with 1 changes to 1 files | ||||
Denis Laxalde
|
r34662 | new changesets 8580ff50825a | ||
Nicolas Dumazet
|
r11784 | updating to branch default | ||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ hg --cwd b import -v ../a.diff | ||||
applying ../a.diff | ||||
Using custom patch | ||||
Greg Ward
|
r15194 | applied to working directory | ||
Mads Kiilerich
|
r12645 | |||
Issue2417: hg import with # comments in description | ||||
Prepare source repo and patch: | ||||
$ rm $HGRCPATH | ||||
$ hg init c | ||||
$ cd c | ||||
Wagner Bruna
|
r14832 | $ printf "a\rc" > a | ||
Mads Kiilerich
|
r12645 | $ hg ci -A -m 0 a -d '0 0' | ||
Wagner Bruna
|
r14832 | $ printf "a\rb\rc" > a | ||
Mads Kiilerich
|
r12645 | $ cat << eof > log | ||
Mads Kiilerich
|
r12728 | > first line which can't start with '# ' | ||
> # second line is a comment but that shouldn't be a problem. | ||||
> A patch marker like this was more problematic even after d7452292f9d3: | ||||
> # HG changeset patch | ||||
> # User lines looks like this - but it _is_ just a comment | ||||
Mads Kiilerich
|
r12645 | > eof | ||
$ hg ci -l log -d '0 0' | ||||
$ hg export -o p 1 | ||||
$ cd .. | ||||
Clone and apply patch: | ||||
$ hg clone -r 0 c d | ||||
adding changesets | ||||
adding manifests | ||||
adding file changes | ||||
added 1 changesets with 1 changes to 1 files | ||||
Denis Laxalde
|
r34662 | new changesets 7fadb901d403 | ||
Mads Kiilerich
|
r12645 | updating to branch default | ||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ cd d | ||||
$ hg import ../c/p | ||||
applying ../c/p | ||||
$ hg log -v -r 1 | ||||
Wagner Bruna
|
r14832 | changeset: 1:cd0bde79c428 | ||
Mads Kiilerich
|
r12645 | tag: tip | ||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
files: a | ||||
description: | ||||
Mads Kiilerich
|
r12728 | first line which can't start with '# ' | ||
# second line is a comment but that shouldn't be a problem. | ||||
A patch marker like this was more problematic even after d7452292f9d3: | ||||
# HG changeset patch | ||||
# User lines looks like this - but it _is_ just a comment | ||||
Mads Kiilerich
|
r12645 | |||
Yuya Nishihara
|
r37477 | |||
Error exit (issue4746) | ||||
Augie Fackler
|
r38104 | $ cat >> exit1.py <<EOF | ||
> import sys | ||||
> sys.exit(1) | ||||
> EOF | ||||
$ hg import ../c/p --config ui.patch="$PYTHON '`pwd`/exit1.py'" | ||||
Yuya Nishihara
|
r37477 | applying ../c/p | ||
abort: patch command failed: exited with status 1 | ||||
[255] | ||||
Mads Kiilerich
|
r12645 | $ cd .. | ||