tests/test-import.t
author Gilles Moris <gilles.moris@free.fr>
Thu, 14 May 2015 17:38:38 +0200
changeset 25111 1ef96a3b8b89
parent 24259 5ac8ce04baa2
child 25154 7b3feaa1ee3f
permissions -rw-r--r--
summary: add a phase line (draft, secret) to the output The number of draft and secret changesets are currently not summarized. This is an important information because the number of drafts give some rough idea of the number of outgoing changesets in typical workflows, without needing to probe a remote repository. And a non-zero number of secrets means that those changeset will not be pushed. If the repository is "dirty" - some draft or secret changesets exists - then summary will display a line like: phases: X draft, Y secret (public) The phase in parenthesis corresponds to the highest phase of the parents of the working directory, i.e. the current phase. By default, the line is not printed if the repository is "clean" - all changesets are public - but if verbose is activated, it will display: phases: (public) On the other hand, nothing will be printed if quiet is in action. A few tests have been added in test-phases.t to cover the -v and -q cases.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     1
  $ hg init a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     2
  $ mkdir a/d1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     3
  $ mkdir a/d1/d2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     4
  $ echo line 1 > a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     5
  $ echo line 1 > a/d1/d2/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     6
  $ hg --cwd a ci -Ama
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     7
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     8
  adding d1/d2/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
     9
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    10
  $ echo line 2 >> a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    11
  $ hg --cwd a ci -u someone -d '1 0' -m'second change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    12
15327
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
    13
import with no args:
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
    14
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
    15
  $ hg --cwd a import
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
    16
  abort: need at least one patch to import
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
    17
  [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    18
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    19
generate patches for the test
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    20
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    21
  $ hg --cwd a export tip > exported-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    22
  $ hg --cwd a diff -r0:1 > diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    23
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    24
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    25
import exported patch
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    26
(this also tests that editor is not invoked, if the patch contains the
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    27
commit message and '--edit' is not specified)
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    28
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    29
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    30
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    31
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    32
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    33
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    34
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    35
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    36
  $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    37
  applying ../exported-tip.patch
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    38
18648
76b69cccb07a export: show 'Date' header in a format that also is readable for humans
Mads Kiilerich <mads@kiilerich.com>
parents: 17712
diff changeset
    39
message and committer and date should be same
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    40
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    41
  $ hg --cwd b tip
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    42
  changeset:   1:1d4bd90af0e4
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    43
  tag:         tip
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    44
  user:        someone
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    45
  date:        Thu Jan 01 00:00:01 1970 +0000
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    46
  summary:     second change
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    47
  
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    48
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    49
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    50
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    51
import exported patch with external patcher
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    52
(this also tests that editor is invoked, if the '--edit' is specified,
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    53
regardless of the commit message in the patch)
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    54
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    55
  $ cat > dummypatch.py <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    56
  > print 'patching file a'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    57
  > file('a', 'wb').write('line2\n')
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    58
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    59
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    60
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    61
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    62
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    63
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    64
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    65
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    66
  $ HGEDITOR=cat hg --config ui.patch='python ../dummypatch.py' --cwd b import --edit ../exported-tip.patch
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    67
  applying ../exported-tip.patch
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    68
  second change
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    69
  
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    70
  
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    71
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    72
  HG: Leave message empty to abort commit.
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    73
  HG: --
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    74
  HG: user: someone
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    75
  HG: branch 'default'
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    76
  HG: changed a
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    77
  $ cat b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    78
  line2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    79
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    80
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    81
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    82
import of plain diff should fail without message
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    83
(this also tests that editor is invoked, if the patch doesn't contain
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
    84
the commit message, regardless of '--edit')
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    85
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    86
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    87
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    88
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    89
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    90
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    91
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
    92
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
22250
f3200bf460a8 import: change "editform" to distinguish merge commits from others
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21553
diff changeset
    93
  $ cat > $TESTTMP/editor.sh <<EOF
f3200bf460a8 import: change "editform" to distinguish merge commits from others
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21553
diff changeset
    94
  > env | grep HGEDITFORM
f3200bf460a8 import: change "editform" to distinguish merge commits from others
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21553
diff changeset
    95
  > cat \$1
f3200bf460a8 import: change "editform" to distinguish merge commits from others
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21553
diff changeset
    96
  > EOF
f3200bf460a8 import: change "editform" to distinguish merge commits from others
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21553
diff changeset
    97
  $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
    98
  applying ../diffed-tip.patch
22250
f3200bf460a8 import: change "editform" to distinguish merge commits from others
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 21553
diff changeset
    99
  HGEDITFORM=import.normal.normal
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   100
  
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   101
  
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   102
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   103
  HG: Leave message empty to abort commit.
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   104
  HG: --
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   105
  HG: user: test
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   106
  HG: branch 'default'
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   107
  HG: changed a
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   108
  abort: empty commit message
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11807
diff changeset
   109
  [255]
22278
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   110
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   111
Test avoiding editor invocation at applying the patch with --exact,
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   112
even if commit message is empty
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   113
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   114
  $ echo a >> b/a
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   115
  $ hg --cwd b commit -m ' '
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   116
  $ hg --cwd b tip -T "{node}\n"
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   117
  d8804f3f5396d800812f579c8452796a5993bdb2
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   118
  $ hg --cwd b export -o ../empty-log.diff .
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   119
  $ hg --cwd b update -q -C ".^1"
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   120
  $ hg --cwd b --config extensions.strip= strip -q tip
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   121
  $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   122
  applying ../empty-log.diff
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   123
  $ hg --cwd b tip -T "{node}\n"
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   124
  d8804f3f5396d800812f579c8452796a5993bdb2
ffaaa80fa724 import: avoid editor invocation when importing with "--exact" for exact-ness
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 22250
diff changeset
   125
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   126
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   127
7247
c4461ea8b4c8 patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents: 6758
diff changeset
   128
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   129
import of plain diff should be ok with message
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   130
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   131
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   132
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   133
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   134
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   135
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   136
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   137
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   138
  $ hg --cwd b import -mpatch ../diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   139
  applying ../diffed-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   140
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   141
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   142
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   143
import of plain diff with specific date and user
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   144
(this also tests that editor is not invoked, if
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   145
'--message'/'--logfile' is specified and '--edit' is not)
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   146
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   147
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   148
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   149
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   150
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   151
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   152
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   153
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   154
  $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   155
  applying ../diffed-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   156
  $ hg -R b tip -pv
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   157
  changeset:   1:ca68f19f3a40
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   158
  tag:         tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   159
  user:        user@nowhere.net
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   160
  date:        Thu Jan 01 00:00:01 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   161
  files:       a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   162
  description:
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   163
  patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   164
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   165
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   166
  diff -r 80971e65b431 -r ca68f19f3a40 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   167
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   168
  +++ b/a	Thu Jan 01 00:00:01 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   169
  @@ -1,1 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   170
   line 1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   171
  +line 2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   172
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   173
  $ rm -r b
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   174
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   175
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   176
import of plain diff should be ok with --no-commit
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   177
(this also tests that editor is not invoked, if '--no-commit' is
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   178
specified, regardless of '--edit')
5953
e7f1be4bf40a Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents: 5937
diff changeset
   179
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   180
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   181
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   182
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   183
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   184
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   185
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   186
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
21417
308aaeb956e2 import: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19513
diff changeset
   187
  $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   188
  applying ../diffed-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   189
  $ hg --cwd b diff --nodates
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   190
  diff -r 80971e65b431 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   191
  --- a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   192
  +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   193
  @@ -1,1 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   194
   line 1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   195
  +line 2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   196
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   197
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   198
12675
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   199
import of malformed plain diff should fail
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   200
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   201
  $ hg clone -r0 a b
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   202
  adding changesets
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   203
  adding manifests
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   204
  adding file changes
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   205
  added 1 changesets with 2 changes to 2 files
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   206
  updating to branch default
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   207
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   208
  $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
12675
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   209
  $ hg --cwd b import -mpatch ../broken.patch
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   210
  applying ../broken.patch
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   211
  abort: bad hunk #1
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   212
  [255]
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   213
  $ rm -r b
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   214
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
   215
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   216
hg -R repo import
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   217
put the clone in a subdir - having a directory named "a"
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   218
used to hide a bug.
5937
d8878742a924 Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5853
diff changeset
   219
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   220
  $ mkdir dir
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   221
  $ hg clone -r0 a dir/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   222
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   223
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   224
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   225
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   226
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   227
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   228
  $ cd dir
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   229
  $ hg -R b import ../exported-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   230
  applying ../exported-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   231
  $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   232
  $ rm -r dir
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   233
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   234
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   235
import from stdin
4230
c93562fb12cc Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
   236
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   237
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   238
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   239
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   240
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   241
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   242
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   243
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   244
  $ hg --cwd b import - < exported-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   245
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   246
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   247
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   248
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   249
import two patches in one stream
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   250
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   251
  $ hg init b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   252
  $ hg --cwd a export 0:tip | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   253
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   254
  $ hg --cwd a id
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   255
  1d4bd90af0e4 tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   256
  $ hg --cwd b id
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   257
  1d4bd90af0e4 tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   258
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   259
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   260
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   261
override commit message
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   262
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   263
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   264
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   265
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   266
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   267
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   268
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   269
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   270
  $ hg --cwd b import -m 'override' - < exported-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   271
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   272
  $ hg --cwd b tip | grep override
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   273
  summary:     override
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   274
  $ rm -r b
10384
832f35386067 import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents: 9594
diff changeset
   275
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   276
  $ cat > mkmsg.py <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   277
  > import email.Message, sys
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   278
  > msg = email.Message.Message()
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   279
  > patch = open(sys.argv[1], 'rb').read()
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   280
  > msg.set_payload('email commit message\n' + patch)
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   281
  > msg['Subject'] = 'email patch'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   282
  > msg['From'] = 'email patcher'
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
   283
  > file(sys.argv[2], 'wb').write(msg.as_string())
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   284
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   285
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   286
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   287
plain diff in email, subject, message body
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   288
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   289
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   290
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   291
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   292
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   293
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   294
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   295
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
   296
  $ python mkmsg.py diffed-tip.patch msg.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   297
  $ hg --cwd b import ../msg.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   298
  applying ../msg.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   299
  $ hg --cwd b tip | grep email
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   300
  user:        email patcher
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   301
  summary:     email patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   302
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   303
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   304
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   305
plain diff in email, no subject, message body
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   306
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   307
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   308
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   309
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   310
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   311
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   312
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   313
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   314
  $ grep -v '^Subject:' msg.patch | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   315
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   316
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   317
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   318
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   319
plain diff in email, subject, no message body
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   320
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   321
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   322
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   323
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   324
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   325
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   326
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   327
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   328
  $ grep -v '^email ' msg.patch | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   329
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   330
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   331
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   332
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   333
plain diff in email, no subject, no message body, should fail
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   334
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   335
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   336
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   337
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   338
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   339
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   340
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   341
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   342
  $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   343
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   344
  abort: empty commit message
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11807
diff changeset
   345
  [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   346
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   347
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   348
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   349
hg export in email, should use patch header
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   350
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   351
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   352
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   353
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   354
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   355
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   356
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   357
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
   358
  $ python mkmsg.py exported-tip.patch msg.patch
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
   359
  $ cat msg.patch | hg --cwd b import -
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   360
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   361
  $ hg --cwd b tip | grep second
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   362
  summary:     second change
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   363
  $ rm -r b
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   364
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   365
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   366
subject: duplicate detection, removal of [PATCH]
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   367
The '---' tests the gitsendmail handling without proper mail headers
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   368
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   369
  $ cat > mkmsg2.py <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   370
  > import email.Message, sys
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   371
  > msg = email.Message.Message()
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   372
  > patch = open(sys.argv[1], 'rb').read()
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   373
  > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   374
  > msg['Subject'] = '[PATCH] email patch'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   375
  > msg['From'] = 'email patcher'
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
   376
  > file(sys.argv[2], 'wb').write(msg.as_string())
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   377
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   378
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   379
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   380
plain diff in email, [PATCH] subject, message body with subject
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   381
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   382
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   383
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   384
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   385
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   386
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   387
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   388
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
   389
  $ python mkmsg2.py diffed-tip.patch msg.patch
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
   390
  $ cat msg.patch | hg --cwd b import -
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   391
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   392
  $ hg --cwd b tip --template '{desc}\n'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   393
  email patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   394
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   395
  next line
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   396
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   397
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   398
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   399
Issue963: Parent of working dir incorrect after import of multiple
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   400
patches and rollback
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   401
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   402
We weren't backing up the correct dirstate file when importing many
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   403
patches: import patch1 patch2; rollback
4779
a7915f79d4cc Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4230
diff changeset
   404
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   405
  $ echo line 3 >> a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   406
  $ hg --cwd a ci -m'third change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   407
  $ hg --cwd a export -o '../patch%R' 1 2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   408
  $ hg clone -qr0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   409
  $ hg --cwd b parents --template 'parent: {rev}\n'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   410
  parent: 0
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   411
  $ hg --cwd b import -v ../patch1 ../patch2
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   412
  applying ../patch1
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   413
  patching file a
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 22947
diff changeset
   414
  committing files:
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   415
  a
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 22947
diff changeset
   416
  committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 22947
diff changeset
   417
  committing changelog
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   418
  created 1d4bd90af0e4
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   419
  applying ../patch2
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   420
  patching file a
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 22947
diff changeset
   421
  committing files:
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   422
  a
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 22947
diff changeset
   423
  committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 22947
diff changeset
   424
  committing changelog
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   425
  created 6d019af21222
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   426
  $ hg --cwd b rollback
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   427
  repository tip rolled back to revision 0 (undo import)
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   428
  working directory now based on revision 0
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   429
  $ hg --cwd b parents --template 'parent: {rev}\n'
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   430
  parent: 0
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   431
  $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   432
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   433
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   434
importing a patch in a subdirectory failed at the commit stage
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   435
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   436
  $ echo line 2 >> a/d1/d2/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   437
  $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   438
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   439
hg import in a subdirectory
4779
a7915f79d4cc Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4230
diff changeset
   440
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   441
  $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   442
  adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   443
  adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   444
  adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   445
  added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   446
  updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   447
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
   448
  $ hg --cwd a export tip > tmp
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   449
  $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   450
  $ dir=`pwd`
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   451
  $ cd b/d1/d2 2>&1 > /dev/null
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   452
  $ hg import  ../../../subdir-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   453
  applying ../../../subdir-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   454
  $ cd "$dir"
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   455
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   456
message should be 'subdir change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   457
committer should be 'someoneelse'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   458
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   459
  $ hg --cwd b tip
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   460
  changeset:   1:3577f5aea227
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   461
  tag:         tip
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   462
  user:        someoneelse
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   463
  date:        Thu Jan 01 00:00:01 1970 +0000
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   464
  summary:     subdir change
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   465
  
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   466
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   467
should be empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   468
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   469
  $ hg --cwd b status
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   470
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   471
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   472
Test fuzziness (ambiguous patch location, fuzz=2)
4779
a7915f79d4cc Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4230
diff changeset
   473
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   474
  $ hg init fuzzy
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   475
  $ cd fuzzy
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   476
  $ echo line1 > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   477
  $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   478
  $ echo line3 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   479
  $ hg ci -Am adda
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   480
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   481
  $ echo line1 > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   482
  $ echo line2 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   483
  $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   484
  $ echo line3 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   485
  $ hg ci -m change a
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   486
  $ hg export tip > fuzzy-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   487
  $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   488
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   489
  $ echo line1 > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   490
  $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   491
  $ echo line1 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   492
  $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   493
  $ hg ci -m brancha
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   494
  created new head
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   495
  $ hg import --no-commit -v fuzzy-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   496
  applying fuzzy-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   497
  patching file a
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
   498
  Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   499
  applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   500
  $ hg revert -a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   501
  reverting a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   502
12913
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
   503
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
   504
import with --no-commit should have written .hg/last-message.txt
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
   505
12945
99f7dc8def34 test-import: workaround for missing newline is no longer needed
Mads Kiilerich <mads@kiilerich.com>
parents: 12914
diff changeset
   506
  $ cat .hg/last-message.txt
99f7dc8def34 test-import: workaround for missing newline is no longer needed
Mads Kiilerich <mads@kiilerich.com>
parents: 12914
diff changeset
   507
  change (no-eol)
12913
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
   508
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
   509
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   510
test fuzziness with eol=auto
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   511
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   512
  $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
   513
  applying fuzzy-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   514
  patching file a
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
   515
  Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   516
  applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   517
  $ cd ..
5548
1fb38ef1f113 test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents: 5418
diff changeset
   518
1fb38ef1f113 test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents: 5418
diff changeset
   519
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   520
Test hunk touching empty files (issue906)
5852
03ce5a919ae3 patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents: 5548
diff changeset
   521
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   522
  $ hg init empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   523
  $ cd empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   524
  $ touch a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   525
  $ touch b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   526
  $ touch c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   527
  $ echo d > d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   528
  $ hg ci -Am init
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   529
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   530
  adding b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   531
  adding c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   532
  adding d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   533
  $ echo a > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   534
  $ echo b > b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   535
  $ hg mv b1 b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   536
  $ echo c > c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   537
  $ hg copy c1 c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   538
  $ rm d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   539
  $ touch d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   540
  $ hg diff --git
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   541
  diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   542
  --- a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   543
  +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   544
  @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   545
  +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   546
  diff --git a/b1 b/b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   547
  rename from b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   548
  rename to b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   549
  --- a/b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   550
  +++ b/b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   551
  @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   552
  +b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   553
  diff --git a/c1 b/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   554
  --- a/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   555
  +++ b/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   556
  @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   557
  +c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   558
  diff --git a/c1 b/c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   559
  copy from c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   560
  copy to c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   561
  --- a/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   562
  +++ b/c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   563
  @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   564
  +c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   565
  diff --git a/d b/d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   566
  --- a/d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   567
  +++ b/d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   568
  @@ -1,1 +0,0 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   569
  -d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   570
  $ hg ci -m empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   571
  $ hg export --git tip > empty.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   572
  $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   573
  4 files updated, 0 files merged, 2 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   574
  $ hg import empty.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   575
  applying empty.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   576
  $ for name in a b1 b2 c1 c2 d; do
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   577
  >   echo % $name file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   578
  >   test -f $name && cat $name
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   579
  >   done
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   580
  % a file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   581
  a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   582
  % b1 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   583
  % b2 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   584
  b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   585
  % c1 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   586
  c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   587
  % c2 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   588
  c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   589
  % d file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   590
  $ cd ..
5852
03ce5a919ae3 patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents: 5548
diff changeset
   591
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   592
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   593
Test importing a patch ending with a binary file removal
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   594
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   595
  $ hg init binaryremoval
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   596
  $ cd binaryremoval
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   597
  $ echo a > a
22947
c63a09b6b337 tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents: 22858
diff changeset
   598
  $ $PYTHON -c "file('b', 'wb').write('a\x00b')"
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   599
  $ hg ci -Am addall
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   600
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   601
  adding b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   602
  $ hg rm a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   603
  $ hg rm b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   604
  $ hg st
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   605
  R a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   606
  R b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   607
  $ hg ci -m remove
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   608
  $ hg export --git . > remove.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   609
  $ cat remove.diff | grep git
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   610
  diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   611
  diff --git a/b b/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   612
  $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   613
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   614
  $ hg import remove.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   615
  applying remove.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   616
  $ hg manifest
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   617
  $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   618
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   619
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   620
Issue927: test update+rename with common name
6179
36ab165abbe2 patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents: 6001
diff changeset
   621
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   622
  $ hg init t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   623
  $ cd t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   624
  $ touch a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   625
  $ hg ci -Am t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   626
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   627
  $ echo a > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   628
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   629
Here, bfile.startswith(afile)
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   630
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   631
  $ hg copy a a2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   632
  $ hg ci -m copya
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   633
  $ hg export --git tip > copy.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   634
  $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   635
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   636
  $ hg import copy.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   637
  applying copy.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   638
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   639
a should contain an 'a'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   640
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   641
  $ cat a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   642
  a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   643
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   644
and a2 should have duplicated it
6520
ba0b2dacc623 fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6295
diff changeset
   645
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   646
  $ cat a2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   647
  a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   648
  $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   649
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   650
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   651
test -p0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   652
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   653
  $ hg init p0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   654
  $ cd p0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   655
  $ echo a > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   656
  $ hg ci -Am t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   657
  adding a
17712
c4717f44c1f1 fancyopts: don't show a traceback on invalid integer values
Idan Kamara <idankk86@gmail.com>
parents: 16912
diff changeset
   658
  $ hg import -p foo
c4717f44c1f1 fancyopts: don't show a traceback on invalid integer values
Idan Kamara <idankk86@gmail.com>
parents: 16912
diff changeset
   659
  abort: invalid value 'foo' for option -p, expected int
c4717f44c1f1 fancyopts: don't show a traceback on invalid integer values
Idan Kamara <idankk86@gmail.com>
parents: 16912
diff changeset
   660
  [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   661
  $ hg import -p0 - << EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   662
  > foobar
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   663
  > --- a	Sat Apr 12 22:43:58 2008 -0400
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   664
  > +++ a	Sat Apr 12 22:44:05 2008 -0400
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   665
  > @@ -1,1 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   666
  > -a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   667
  > +bb
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   668
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   669
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   670
  $ hg status
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   671
  $ cat a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   672
  bb
24259
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   673
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   674
test --prefix
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   675
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   676
  $ mkdir -p dir/dir2
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   677
  $ echo b > dir/dir2/b
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   678
  $ hg ci -Am b
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   679
  adding dir/dir2/b
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   680
  $ hg import -p2 --prefix dir - << EOF
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   681
  > foobar
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   682
  > --- drop1/drop2/dir2/b
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   683
  > +++ drop1/drop2/dir2/b
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   684
  > @@ -1,1 +1,1 @@
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   685
  > -b
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   686
  > +cc
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   687
  > EOF
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   688
  applying patch from stdin
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   689
  $ hg status
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   690
  $ cat dir/dir2/b
5ac8ce04baa2 cmdutil.tryimportone: allow importing relative patches into the working dir
Siddharth Agarwal <sid0@fb.com>
parents: 23749
diff changeset
   691
  cc
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   692
  $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   693
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   694
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   695
test paths outside repo root
6758
87c704ac92d4 Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents: 6520
diff changeset
   696
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   697
  $ mkdir outside
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   698
  $ touch outside/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   699
  $ hg init inside
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   700
  $ cd inside
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   701
  $ hg import - <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   702
  > diff --git a/a b/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   703
  > rename from ../outside/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   704
  > rename to bar
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   705
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   706
  applying patch from stdin
16889
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
   707
  abort: path contains illegal component: ../outside/foo (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11807
diff changeset
   708
  [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   709
  $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   710
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   711
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   712
test import with similarity and git and strip (issue295 et al.)
7402
bffdab64dfbb import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents: 7247
diff changeset
   713
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   714
  $ hg init sim
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   715
  $ cd sim
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   716
  $ echo 'this is a test' > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   717
  $ hg ci -Ama
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   718
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   719
  $ cat > ../rename.diff <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   720
  > diff --git a/foo/a b/foo/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   721
  > deleted file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   722
  > --- a/foo/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   723
  > +++ /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   724
  > @@ -1,1 +0,0 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   725
  > -this is a test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   726
  > diff --git a/foo/b b/foo/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   727
  > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   728
  > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   729
  > +++ b/foo/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   730
  > @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   731
  > +this is a test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   732
  > +foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   733
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   734
  $ hg import --no-commit -v -s 1 ../rename.diff -p2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   735
  applying ../rename.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   736
  patching file a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   737
  patching file b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   738
  adding b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   739
  recording removal of a as rename to b (88% similar)
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   740
  applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   741
  $ hg st -C
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   742
  A b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   743
    a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   744
  R a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   745
  $ hg revert -a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   746
  undeleting a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   747
  forgetting b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   748
  $ rm b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   749
  $ hg import --no-commit -v -s 100 ../rename.diff -p2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   750
  applying ../rename.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   751
  patching file a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   752
  patching file b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   753
  adding b
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
   754
  applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   755
  $ hg st -C
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   756
  A b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   757
  R a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   758
  $ cd ..
7971
6ea0318daf75 Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents: 7402
diff changeset
   759
6ea0318daf75 Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents: 7402
diff changeset
   760
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   761
Issue1495: add empty file from the end of patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   762
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   763
  $ hg init addemptyend
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   764
  $ cd addemptyend
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   765
  $ touch a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   766
  $ hg addremove
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   767
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   768
  $ hg ci -m "commit"
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   769
  $ cat > a.patch <<EOF
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   770
  > add a, b
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   771
  > diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   772
  > --- a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   773
  > +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   774
  > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   775
  > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   776
  > diff --git a/b b/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   777
  > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   778
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   779
  $ hg import --no-commit a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   780
  applying a.patch
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   781
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   782
apply a good patch followed by an empty patch (mainly to ensure
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   783
that dirstate is *not* updated when import crashes)
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   784
  $ hg update -q -C .
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   785
  $ rm b
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   786
  $ touch empty.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   787
  $ hg import a.patch empty.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   788
  applying a.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   789
  applying empty.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   790
  transaction abort!
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   791
  rollback completed
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   792
  abort: empty.patch: no diffs found
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   793
  [255]
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   794
  $ hg tip --template '{rev}  {desc|firstline}\n'
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   795
  0  commit
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   796
  $ hg -q status
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
   797
  M a
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   798
  $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   799
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   800
create file when source is not /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   801
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   802
  $ cat > create.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   803
  > diff -Naur proj-orig/foo proj-new/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   804
  > --- proj-orig/foo       1969-12-31 16:00:00.000000000 -0800
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   805
  > +++ proj-new/foo        2009-07-17 16:50:45.801368000 -0700
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   806
  > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   807
  > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   808
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   809
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   810
some people have patches like the following too
9573
b8352a3617f3 patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   811
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   812
  $ cat > create2.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   813
  > diff -Naur proj-orig/foo proj-new/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   814
  > --- proj-orig/foo.orig  1969-12-31 16:00:00.000000000 -0800
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   815
  > +++ proj-new/foo        2009-07-17 16:50:45.801368000 -0700
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   816
  > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   817
  > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   818
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   819
  $ hg init oddcreate
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   820
  $ cd oddcreate
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   821
  $ hg import --no-commit ../create.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   822
  applying ../create.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   823
  $ cat foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   824
  a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   825
  $ rm foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   826
  $ hg revert foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   827
  $ hg import --no-commit ../create2.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   828
  applying ../create2.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   829
  $ cat foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   830
  a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   831
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16889
diff changeset
   832
  $ cd ..
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   833
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   834
Issue1859: first line mistaken for email headers
9576
c156bf947e26 Merge with stable
Matt Mackall <mpm@selenic.com>
parents: 9328 9573
diff changeset
   835
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   836
  $ hg init emailconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   837
  $ cd emailconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   838
  $ cat > a.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   839
  > module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   840
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   841
  > description
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   842
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   843
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   844
  > diff -r 000000000000 -r 9b4c1e343b55 test.txt
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   845
  > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   846
  > +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   847
  > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   848
  > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   849
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   850
  $ hg import -d '0 0' a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   851
  applying a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   852
  $ hg parents -v
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   853
  changeset:   0:5a681217c0ad
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   854
  tag:         tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   855
  user:        test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   856
  date:        Thu Jan 01 00:00:00 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   857
  files:       a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   858
  description:
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   859
  module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   860
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   861
  description
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   862
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   863
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   864
  $ cd ..
9573
b8352a3617f3 patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   865
b8352a3617f3 patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
   866
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16889
diff changeset
   867
in commit message
10729
7a5931c5f2dc patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10524
diff changeset
   868
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   869
  $ hg init commitconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   870
  $ cd commitconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   871
  $ cat > a.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   872
  > module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   873
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   874
  > --- description
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   875
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   876
  > diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   877
  > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   878
  > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   879
  > +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   880
  > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   881
  > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   882
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   883
  > hg import -d '0 0' a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   884
  > hg parents -v
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   885
  > cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   886
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   887
  > echo '% tricky header splitting'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   888
  > cat > trickyheaders.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   889
  > From: User A <user@a>
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   890
  > Subject: [PATCH] from: tricky!
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   891
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   892
  > # HG changeset patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   893
  > # User User B
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   894
  > # Date 1266264441 18000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   895
  > # Branch stable
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   896
  > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   897
  > # Parent  0000000000000000000000000000000000000000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   898
  > from: tricky!
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   899
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   900
  > That is not a header.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   901
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   902
  > diff -r 000000000000 -r f2be6a1170ac foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   903
  > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   904
  > +++ b/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   905
  > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   906
  > +foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   907
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   908
  applying a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   909
  changeset:   0:f34d9187897d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   910
  tag:         tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   911
  user:        test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   912
  date:        Thu Jan 01 00:00:00 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   913
  files:       a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   914
  description:
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   915
  module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   916
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   917
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   918
  % tricky header splitting
10501
a27af7229850 import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents: 10384
diff changeset
   919
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   920
  $ hg init trickyheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   921
  $ cd trickyheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   922
  $ hg import -d '0 0' ../trickyheaders.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   923
  applying ../trickyheaders.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   924
  $ hg export --git tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   925
  # HG changeset patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   926
  # User User B
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   927
  # Date 0 0
18648
76b69cccb07a export: show 'Date' header in a format that also is readable for humans
Mads Kiilerich <mads@kiilerich.com>
parents: 17712
diff changeset
   928
  #      Thu Jan 01 00:00:00 1970 +0000
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   929
  # Node ID eb56ab91903632294ac504838508cb370c0901d2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   930
  # Parent  0000000000000000000000000000000000000000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   931
  from: tricky!
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   932
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   933
  That is not a header.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   934
  
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   935
  diff --git a/foo b/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   936
  new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   937
  --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   938
  +++ b/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   939
  @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   940
  +foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   941
  $ cd ..
10501
a27af7229850 import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents: 10384
diff changeset
   942
a27af7229850 import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents: 10384
diff changeset
   943
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
   944
Issue2102: hg export and hg import speak different languages
10748
fb06e357e698 patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10745
diff changeset
   945
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   946
  $ hg init issue2102
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   947
  $ cd issue2102
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   948
  $ mkdir -p src/cmd/gc
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   949
  $ touch src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   950
  $ hg ci -Am init
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   951
  adding src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   952
  $ hg import - <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   953
  > # HG changeset patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   954
  > # User Rob Pike
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   955
  > # Date 1216685449 25200
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   956
  > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   957
  > # Parent  93d10138ad8df586827ca90b4ddb5033e21a3a84
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   958
  > help management of empty pkg and lib directories in perforce
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   959
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   960
  > R=gri
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   961
  > DELTA=4  (4 added, 0 deleted, 0 changed)
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   962
  > OCL=13328
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   963
  > CL=13328
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   964
  > 
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   965
  > diff --git a/lib/place-holder b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   966
  > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   967
  > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   968
  > +++ b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   969
  > @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   970
  > +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   971
  > +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   972
  > diff --git a/pkg/place-holder b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   973
  > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   974
  > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   975
  > +++ b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   976
  > @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   977
  > +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   978
  > +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   979
  > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   980
  > old mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   981
  > new mode 100755
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   982
  > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   983
  applying patch from stdin
16889
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
   984
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
   985
#if execbit
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
   986
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   987
  $ hg sum
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   988
  parent: 1:d59915696727 tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   989
   help management of empty pkg and lib directories in perforce
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   990
  branch: default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   991
  commit: (clean)
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   992
  update: (current)
25111
1ef96a3b8b89 summary: add a phase line (draft, secret) to the output
Gilles Moris <gilles.moris@free.fr>
parents: 24259
diff changeset
   993
  phases: 2 draft (draft)
16889
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
   994
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   995
  $ hg diff --git -c tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   996
  diff --git a/lib/place-holder b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   997
  new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   998
  --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
   999
  +++ b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1000
  @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1001
  +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1002
  +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1003
  diff --git a/pkg/place-holder b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1004
  new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1005
  --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1006
  +++ b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1007
  @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1008
  +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1009
  +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1010
  diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1011
  old mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1012
  new mode 100755
16889
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1013
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1014
#else
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1015
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1016
  $ hg sum
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1017
  parent: 1:28f089cc9ccc tip
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1018
   help management of empty pkg and lib directories in perforce
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1019
  branch: default
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1020
  commit: (clean)
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1021
  update: (current)
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1022
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1023
  $ hg diff --git -c tip
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1024
  diff --git a/lib/place-holder b/lib/place-holder
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1025
  new file mode 100644
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1026
  --- /dev/null
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1027
  +++ b/lib/place-holder
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1028
  @@ -0,0 +1,2 @@
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1029
  +perforce does not maintain empty directories.
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1030
  +this file helps.
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1031
  diff --git a/pkg/place-holder b/pkg/place-holder
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1032
  new file mode 100644
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1033
  --- /dev/null
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1034
  +++ b/pkg/place-holder
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1035
  @@ -0,0 +1,2 @@
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1036
  +perforce does not maintain empty directories.
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1037
  +this file helps.
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1038
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1039
/* The mode change for mksys.bash is missing here, because on platforms  */
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1040
/* that don't support execbits, mode changes in patches are ignored when */
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1041
/* they are imported. This is obviously also the reason for why the hash */
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1042
/* in the created changeset is different to the one you see above the    */
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1043
/* #else clause */
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1044
0074c2babb13 test-import: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 16888
diff changeset
  1045
#endif
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1046
  $ cd ..
10748
fb06e357e698 patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10745
diff changeset
  1047
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1048
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1049
diff lines looking like headers
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1050
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1051
  $ hg init difflineslikeheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1052
  $ cd difflineslikeheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1053
  $ echo a >a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1054
  $ echo b >b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1055
  $ echo c >c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1056
  $ hg ci -Am1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1057
  adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1058
  adding b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1059
  adding c
10883
196908117c27 patch: don't look for headers in diff lines
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10775
diff changeset
  1060
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1061
  $ echo "key: value" >>a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1062
  $ echo "key: value" >>b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1063
  $ echo "foo" >>c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1064
  $ hg ci -m2
10883
196908117c27 patch: don't look for headers in diff lines
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10775
diff changeset
  1065
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1066
  $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1067
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1068
  $ hg diff --git -c1 >want
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1069
  $ hg diff -c1 | hg import --no-commit -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1070
  applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1071
  $ hg diff --git >have
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1072
  $ diff want have
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
  1073
  $ cd ..
10883
196908117c27 patch: don't look for headers in diff lines
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10775
diff changeset
  1074
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1075
import a unified diff with no lines of context (diff -U0)
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1076
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1077
  $ hg init diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1078
  $ cd diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1079
  $ cat > f << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1080
  > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1081
  > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1082
  > c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1083
  > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1084
  $ hg commit -Am0
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1085
  adding f
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1086
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1087
  $ hg import --no-commit - << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1088
  > # HG changeset patch
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1089
  > # User test
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1090
  > # Date 0 0
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1091
  > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1092
  > # Parent  8679a12a975b819fae5f7ad3853a2886d143d794
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1093
  > 1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1094
  > diff -r 8679a12a975b -r f4974ab632f3 f
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1095
  > --- a/f	Thu Jan 01 00:00:00 1970 +0000
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1096
  > +++ b/f	Thu Jan 01 00:00:00 1970 +0000
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1097
  > @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1098
  > +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1099
  > @@ -1,0 +3,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1100
  > +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1101
  > @@ -3,1 +4,0 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1102
  > -c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1103
  > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1104
  applying patch from stdin
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1105
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1106
  $ cat f
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1107
  c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1108
  c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1109
  c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
  1110
  c4
16123
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1111
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16889
diff changeset
  1112
  $ cd ..
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16889
diff changeset
  1113
16650
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1114
no segfault while importing a unified diff which start line is zero but chunk
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1115
size is non-zero
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1116
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1117
  $ hg init startlinezero
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1118
  $ cd startlinezero
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1119
  $ echo foo > foo
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1120
  $ hg commit -Amfoo
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1121
  adding foo
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1122
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1123
  $ hg import --no-commit - << EOF
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1124
  > diff a/foo b/foo
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1125
  > --- a/foo
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1126
  > +++ b/foo
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1127
  > @@ -0,1 +0,1 @@
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1128
  >  foo
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1129
  > EOF
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1130
  applying patch from stdin
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1131
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1132
  $ cd ..
fcb97d9a26cd patch: fix segfault against unified diffs which start line is zero
Yuya Nishihara <yuya@tcha.org>
parents: 16124
diff changeset
  1133
16123
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1134
Test corner case involving fuzz and skew
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1135
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1136
  $ hg init morecornercases
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1137
  $ cd morecornercases
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1138
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1139
  $ cat > 01-no-context-beginning-of-file.diff <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1140
  > diff --git a/a b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1141
  > --- a/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1142
  > +++ b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1143
  > @@ -1,0 +1,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1144
  > +line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1145
  > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1146
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1147
  $ cat > 02-no-context-middle-of-file.diff <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1148
  > diff --git a/a b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1149
  > --- a/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1150
  > +++ b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1151
  > @@ -1,1 +1,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1152
  > -2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1153
  > +add some skew
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1154
  > @@ -2,0 +2,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1155
  > +line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1156
  > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1157
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1158
  $ cat > 03-no-context-end-of-file.diff <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1159
  > diff --git a/a b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1160
  > --- a/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1161
  > +++ b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1162
  > @@ -10,0 +10,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1163
  > +line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1164
  > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1165
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1166
  $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1167
  > diff --git a/a b/a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1168
  > --- a/a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1169
  > +++ b/a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1170
  > @@ -1,1 +1,1 @@
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1171
  > -2
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1172
  > +add some skew
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1173
  > @@ -2,2 +2,3 @@
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1174
  >  not matching, should fuzz
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1175
  >  ... a bit
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1176
  > +line
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1177
  > EOF
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1178
16123
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1179
  $ cat > a <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1180
  > 1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1181
  > 2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1182
  > 3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1183
  > 4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1184
  > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1185
  $ hg ci -Am adda a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1186
  $ for p in *.diff; do
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1187
  >   hg import -v --no-commit $p
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1188
  >   cat a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1189
  >   hg revert -aqC a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1190
  >   # patch -p1 < $p
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1191
  >   # cat a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1192
  >   # hg revert -aC a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1193
  > done
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1194
  applying 01-no-context-beginning-of-file.diff
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1195
  patching file a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1196
  applied to working directory
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1197
  1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1198
  line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1199
  2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1200
  3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1201
  4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1202
  applying 02-no-context-middle-of-file.diff
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1203
  patching file a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1204
  Hunk #1 succeeded at 2 (offset 1 lines).
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1205
  Hunk #2 succeeded at 4 (offset 1 lines).
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1206
  applied to working directory
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1207
  1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1208
  add some skew
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1209
  3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1210
  line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1211
  4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1212
  applying 03-no-context-end-of-file.diff
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1213
  patching file a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1214
  Hunk #1 succeeded at 5 (offset -6 lines).
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1215
  applied to working directory
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1216
  1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1217
  2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1218
  3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1219
  4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1220
  line
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1221
  applying 04-middle-of-file-completely-fuzzed.diff
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1222
  patching file a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1223
  Hunk #1 succeeded at 2 (offset 1 lines).
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1224
  Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1225
  applied to working directory
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1226
  1
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1227
  add some skew
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1228
  3
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1229
  4
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
  1230
  line
21553
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1231
  $ cd ..
16123
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
  1232
21553
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1233
Test partial application
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1234
------------------------
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1235
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1236
prepare a stack of patches depending on each other
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1237
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1238
  $ hg init partial
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1239
  $ cd partial
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1240
  $ cat << EOF > a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1241
  > one
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1242
  > two
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1243
  > three
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1244
  > four
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1245
  > five
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1246
  > six
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1247
  > seven
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1248
  > EOF
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1249
  $ hg add a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1250
  $ echo 'b' > b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1251
  $ hg add b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1252
  $ hg commit -m 'initial' -u Babar
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1253
  $ cat << EOF > a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1254
  > one
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1255
  > two
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1256
  > 3
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1257
  > four
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1258
  > five
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1259
  > six
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1260
  > seven
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1261
  > EOF
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1262
  $ hg commit -m 'three' -u Celeste
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1263
  $ cat << EOF > a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1264
  > one
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1265
  > two
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1266
  > 3
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1267
  > 4
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1268
  > five
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1269
  > six
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1270
  > seven
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1271
  > EOF
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1272
  $ hg commit -m 'four' -u Rataxes
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1273
  $ cat << EOF > a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1274
  > one
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1275
  > two
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1276
  > 3
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1277
  > 4
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1278
  > 5
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1279
  > six
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1280
  > seven
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1281
  > EOF
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1282
  $ echo bb >> b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1283
  $ hg commit -m 'five' -u Arthur
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1284
  $ echo 'Babar' > jungle
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1285
  $ hg add jungle
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1286
  $ hg ci -m 'jungle' -u Zephir
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1287
  $ echo 'Celeste' >> jungle
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1288
  $ hg ci -m 'extended jungle' -u Cornelius
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1289
  $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1290
  @  extended jungle [Cornelius] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1291
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1292
  o  jungle [Zephir] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1293
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1294
  o  five [Arthur] 2: +2/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1295
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1296
  o  four [Rataxes] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1297
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1298
  o  three [Celeste] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1299
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1300
  o  initial [Babar] 2: +8/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1301
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1302
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1303
Importing with some success and some errors:
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1304
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1305
  $ hg update --rev 'desc(initial)'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1306
  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1307
  $ hg export --rev 'desc(five)' | hg import --partial -
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1308
  applying patch from stdin
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1309
  patching file a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1310
  Hunk #1 FAILED at 1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1311
  1 out of 1 hunks FAILED -- saving rejects to file a.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1312
  patch applied partially
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1313
  (fix the .rej files and run `hg commit --amend`)
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1314
  [1]
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1315
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1316
  $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1317
  @  five [Arthur] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1318
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1319
  | o  extended jungle [Cornelius] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1320
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1321
  | o  jungle [Zephir] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1322
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1323
  | o  five [Arthur] 2: +2/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1324
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1325
  | o  four [Rataxes] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1326
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1327
  | o  three [Celeste] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1328
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1329
  o  initial [Babar] 2: +8/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1330
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1331
  $ hg export
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1332
  # HG changeset patch
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1333
  # User Arthur
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1334
  # Date 0 0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1335
  #      Thu Jan 01 00:00:00 1970 +0000
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1336
  # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1337
  # Parent  8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1338
  five
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1339
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1340
  diff -r 8e4f0351909e -r 26e6446bb252 b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1341
  --- a/b	Thu Jan 01 00:00:00 1970 +0000
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1342
  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1343
  @@ -1,1 +1,2 @@
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1344
   b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1345
  +bb
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1346
  $ hg status -c .
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1347
  C a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1348
  C b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1349
  $ ls
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1350
  a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1351
  a.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1352
  b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1353
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1354
Importing with zero success:
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1355
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1356
  $ hg update --rev 'desc(initial)'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1357
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1358
  $ hg export --rev 'desc(four)' | hg import --partial -
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1359
  applying patch from stdin
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1360
  patching file a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1361
  Hunk #1 FAILED at 0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1362
  1 out of 1 hunks FAILED -- saving rejects to file a.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1363
  patch applied partially
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1364
  (fix the .rej files and run `hg commit --amend`)
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1365
  [1]
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1366
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1367
  $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1368
  @  four [Rataxes] 0: +0/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1369
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1370
  | o  five [Arthur] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1371
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1372
  | o  extended jungle [Cornelius] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1373
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1374
  | o  jungle [Zephir] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1375
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1376
  | o  five [Arthur] 2: +2/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1377
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1378
  | o  four [Rataxes] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1379
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1380
  | o  three [Celeste] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1381
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1382
  o  initial [Babar] 2: +8/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1383
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1384
  $ hg export
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1385
  # HG changeset patch
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1386
  # User Rataxes
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1387
  # Date 0 0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1388
  #      Thu Jan 01 00:00:00 1970 +0000
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1389
  # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1390
  # Parent  8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1391
  four
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1392
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1393
  $ hg status -c .
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1394
  C a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1395
  C b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1396
  $ ls
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1397
  a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1398
  a.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1399
  b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1400
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1401
Importing with unknown file:
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1402
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1403
  $ hg update --rev 'desc(initial)'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1404
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1405
  $ hg export --rev 'desc("extended jungle")' | hg import --partial -
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1406
  applying patch from stdin
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1407
  unable to find 'jungle' for patching
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1408
  1 out of 1 hunks FAILED -- saving rejects to file jungle.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1409
  patch applied partially
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1410
  (fix the .rej files and run `hg commit --amend`)
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1411
  [1]
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1412
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1413
  $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1414
  @  extended jungle [Cornelius] 0: +0/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1415
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1416
  | o  four [Rataxes] 0: +0/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1417
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1418
  | o  five [Arthur] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1419
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1420
  | o  extended jungle [Cornelius] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1421
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1422
  | o  jungle [Zephir] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1423
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1424
  | o  five [Arthur] 2: +2/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1425
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1426
  | o  four [Rataxes] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1427
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1428
  | o  three [Celeste] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1429
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1430
  o  initial [Babar] 2: +8/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1431
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1432
  $ hg export
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1433
  # HG changeset patch
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1434
  # User Cornelius
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1435
  # Date 0 0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1436
  #      Thu Jan 01 00:00:00 1970 +0000
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1437
  # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1438
  # Parent  8e4f0351909eae6b9cf68c2c076cb54c42b54b2e
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1439
  extended jungle
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1440
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1441
  $ hg status -c .
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1442
  C a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1443
  C b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1444
  $ ls
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1445
  a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1446
  a.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1447
  b
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1448
  jungle.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1449
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1450
Importing multiple failing patches:
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1451
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1452
  $ hg update --rev 'desc(initial)'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1453
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1454
  $ echo 'B' > b # just to make another commit
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1455
  $ hg commit -m "a new base"
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1456
  created new head
22858
d7cedb32a8ab test-import.t: use proper revset order
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 22278
diff changeset
  1457
  $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial -
21553
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1458
  applying patch from stdin
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1459
  patching file a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1460
  Hunk #1 FAILED at 0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1461
  1 out of 1 hunks FAILED -- saving rejects to file a.rej
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1462
  patch applied partially
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1463
  (fix the .rej files and run `hg commit --amend`)
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1464
  [1]
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1465
  $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n'
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1466
  @  four [Rataxes] 0: +0/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1467
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1468
  o  a new base [test] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1469
  |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1470
  | o  extended jungle [Cornelius] 0: +0/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1471
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1472
  | o  four [Rataxes] 0: +0/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1473
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1474
  | o  five [Arthur] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1475
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1476
  | o  extended jungle [Cornelius] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1477
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1478
  | o  jungle [Zephir] 1: +1/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1479
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1480
  | o  five [Arthur] 2: +2/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1481
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1482
  | o  four [Rataxes] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1483
  | |
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1484
  | o  three [Celeste] 1: +1/-1
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1485
  |/
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1486
  o  initial [Babar] 2: +8/-0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1487
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1488
  $ hg export
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1489
  # HG changeset patch
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1490
  # User Rataxes
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1491
  # Date 0 0
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1492
  #      Thu Jan 01 00:00:00 1970 +0000
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1493
  # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1494
  # Parent  f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1495
  four
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1496
  
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1497
  $ hg status -c .
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1498
  C a
bee0e1cffdd3 import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21417
diff changeset
  1499
  C b