tests/test-import-bypass.t
author David Schleimer <dschleimer@fb.com>
Fri, 08 Feb 2013 05:36:08 -0800
changeset 18660 7e6946ed5756
parent 16913 f2719b387380
child 20117 aa9385f983fa
permissions -rw-r--r--
localrepo: use workingctx for validation in commit This changes localrepo.commit to use the workingctx it creates form the munged output of localrepo.status while running some precommit validation. Specifically, it uses functions that were already present on the workingctx. I believe this is a net readabilty improvement, and that this makes these lines consistent with the refactoring in a subsequent patch that pulls some of the validation logic into workingctx so that it can be reused elsewhere.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
  $ echo "[extensions]" >> $HGRCPATH
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
  $ echo "purge=" >> $HGRCPATH
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
  $ echo "graphlog=" >> $HGRCPATH
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
  $ shortlog() {
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
  >     hg glog --template '{rev}:{node|short} {author} {date|hgdate} - {branch} - {desc|firstline}\n'
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
  > }
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
Test --bypass with other options
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
  $ hg init repo-options
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
  $ cd repo-options
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
  $ echo a > a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
  $ hg ci -Am adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
  adding a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
  $ echo a >> a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
  $ hg branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
  marked working directory as branch foo
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 15198
diff changeset
    19
  (branches are permanent and global, did you want a bookmark?)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
  $ hg ci -Am changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
  $ hg export . > ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
  $ hg up null
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
Test importing an existing revision
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
  $ hg import --bypass --exact ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
  $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
  o  1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
  o  0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
  
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
Test failure without --exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
  $ hg import --bypass ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
  unable to find 'a' for patching
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
  abort: patch failed to apply
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
  [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
  $ hg st
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
  $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
  o  1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
  o  0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
  
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
Test --user, --date and --message
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
  $ hg up 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
  $ hg import --bypass --u test2 -d '1 0' -m patch2 ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
  $ cat .hg/last-message.txt
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
  patch2 (no-eol)
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
  $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
  o  2:2e127d1da504 test2 1 0 - default - patch2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
  | o  1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
  |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
  @  0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
  
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
    64
  $ hg rollback
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
    65
  repository tip rolled back to revision 1 (undo import)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    67
Test --import-branch
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
  $ hg import --bypass --import-branch ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    71
  $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    72
  o  1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    74
  @  0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    75
  
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
    76
  $ hg rollback
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
    77
  repository tip rolled back to revision 1 (undo import)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    78
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    79
Test --strip
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    81
  $ hg import --bypass --strip 0 - <<EOF
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    82
  > # HG changeset patch
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    83
  > # User test
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    84
  > # Date 0 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    85
  > # Branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    86
  > # Node ID 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    87
  > # Parent  07f4944404050f47db2e5c5071e0e84e7a27bba9
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    88
  > changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    89
  > 
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    90
  > diff -r 07f494440405 -r 4e322f7ce8e3 a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    91
  > --- a	Thu Jan 01 00:00:00 1970 +0000
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    92
  > +++ a	Thu Jan 01 00:00:00 1970 +0000
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    93
  > @@ -1,1 +1,2 @@
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    94
  >  a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    95
  > +a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    96
  > EOF
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    97
  applying patch from stdin
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
    98
  $ hg rollback
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
    99
  repository tip rolled back to revision 1 (undo import)
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   100
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   101
Test unsupported combinations
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   102
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   103
  $ hg import --bypass --no-commit ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   104
  abort: cannot use --no-commit with --bypass
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   105
  [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   106
  $ hg import --bypass --similarity 50 ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   107
  abort: cannot use --similarity with --bypass
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   108
  [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   109
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   110
Test commit editor
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   111
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   112
  $ cat > ../test.diff <<EOF
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   113
  > diff -r 07f494440405 -r 4e322f7ce8e3 a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   114
  > --- a/a	Thu Jan 01 00:00:00 1970 +0000
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   115
  > +++ b/a	Thu Jan 01 00:00:00 1970 +0000
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   116
  > @@ -1,1 +1,2 @@
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   117
  > -a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   118
  > +b
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   119
  > +c
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   120
  > EOF
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   121
  $ HGEDITOR=cat hg import --bypass ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   122
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   123
  
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   124
  
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   125
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   126
  HG: Leave message empty to abort commit.
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   127
  HG: --
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   128
  HG: user: test
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   129
  HG: branch 'default'
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   130
  HG: changed a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   131
  abort: empty commit message
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   132
  [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   133
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   134
Test patch.eol is handled
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   135
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   136
  $ python -c 'file("a", "wb").write("a\r\n")'
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   137
  $ hg ci -m makeacrlf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   138
  $ hg import -m 'should fail because of eol' --bypass ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   139
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   140
  patching file a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   141
  Hunk #1 FAILED at 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   142
  abort: patch failed to apply
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   143
  [255]
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   144
  $ hg --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   145
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   146
  $ shortlog
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
   147
  o  3:c606edafba99 test 0 0 - default - test patch.eol
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   148
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   149
  @  2:872023de769d test 0 0 - default - makeacrlf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   150
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   151
  | o  1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   152
  |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   153
  o  0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   154
  
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   155
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   156
Test applying multiple patches
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   157
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   158
  $ hg up -qC 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   159
  $ echo e > e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   160
  $ hg ci -Am adde
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   161
  adding e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   162
  created new head
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   163
  $ hg export . > ../patch1.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   164
  $ hg up -qC 1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   165
  $ echo f > f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   166
  $ hg ci -Am addf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   167
  adding f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   168
  $ hg export . > ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   169
  $ cd ..
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   170
  $ hg clone -r1 repo-options repo-multi1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   171
  adding changesets
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   172
  adding manifests
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   173
  adding file changes
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   174
  added 2 changesets with 2 changes to 1 files
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   175
  updating to branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   176
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   177
  $ cd repo-multi1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   178
  $ hg up 0
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   179
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   180
  $ hg import --bypass ../patch1.diff ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   181
  applying ../patch1.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   182
  applying ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   183
  $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   184
  o  3:bc8ca3f8a7c4 test 0 0 - default - addf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   185
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   186
  o  2:16581080145e test 0 0 - default - adde
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   187
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   188
  | o  1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   189
  |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   190
  @  0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   191
  
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   192
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   193
Test applying multiple patches with --exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   194
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   195
  $ cd ..
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   196
  $ hg clone -r1 repo-options repo-multi2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   197
  adding changesets
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   198
  adding manifests
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   199
  adding file changes
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   200
  added 2 changesets with 2 changes to 1 files
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   201
  updating to branch foo
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   202
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   203
  $ cd repo-multi2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   204
  $ hg import --bypass --exact ../patch1.diff ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   205
  applying ../patch1.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   206
  applying ../patch2.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   207
  $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   208
  o  3:d60cb8989666 test 0 0 - foo - addf
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   209
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   210
  | o  2:16581080145e test 0 0 - default - adde
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   211
  | |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   212
  @ |  1:4e322f7ce8e3 test 0 0 - foo - changea
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   213
  |/
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   214
  o  0:07f494440405 test 0 0 - default - adda
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   215
  
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   216
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   217
  $ cd ..
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   218
16899
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16124
diff changeset
   219
#if symlink execbit
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16124
diff changeset
   220
14611
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   221
Test complicated patch with --exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   222
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   223
  $ hg init repo-exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   224
  $ cd repo-exact
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   225
  $ echo a > a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   226
  $ echo c > c
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   227
  $ echo d > d
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   228
  $ echo e > e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   229
  $ echo f > f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   230
  $ chmod +x f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   231
  $ ln -s c linkc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   232
  $ hg ci -Am t
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   233
  adding a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   234
  adding c
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   235
  adding d
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   236
  adding e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   237
  adding f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   238
  adding linkc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   239
  $ hg cp a aa1
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   240
  $ echo b >> a
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   241
  $ echo b > b
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   242
  $ hg add b
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   243
  $ hg cp a aa2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   244
  $ echo aa >> aa2
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   245
  $ chmod +x e
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   246
  $ chmod -x f
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   247
  $ ln -s a linka
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   248
  $ hg rm d
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   249
  $ hg rm linkc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   250
  $ hg mv c cc
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   251
  $ hg ci -m patch
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   252
  $ hg export --git . > ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   253
  $ hg up -C null
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   254
  0 files updated, 0 files merged, 7 files removed, 0 files unresolved
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   255
  $ hg purge
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   256
  $ hg st
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   257
  $ hg import --bypass --exact ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   258
  applying ../test.diff
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   259
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   260
The patch should have matched the exported revision and generated no additional
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   261
data. If not, diff both heads to debug it.
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   262
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   263
  $ shortlog
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   264
  o  1:2978fd5c8aa4 test 0 0 - default - patch
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   265
  |
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   266
  o  0:a0e19e636a43 test 0 0 - default - t
adbf5e7df96d import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   267
  
16899
8149ff405c78 tests: convert some 'hghave execbit' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 16124
diff changeset
   268
#endif
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16899
diff changeset
   269
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16899
diff changeset
   270
  $ cd ..