tests/test-import-merge.t
author Adrian Buehlmann <adrian@cadifra.com>
Wed, 09 May 2012 09:58:50 +0200
changeset 16629 1435866c1937
parent 15511 6cae68a361ed
child 16913 f2719b387380
permissions -rw-r--r--
parser: use PyInt_FromSsize_t in index_stats Eliminates mercurial/parsers.c(515) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'long', possible loss of data mercurial/parsers.c(520) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'long', possible loss of data mercurial/parsers.c(521) : warning C4244: 'function' : conversion from 'Py_ssize_t' to 'long', possible loss of data when compiling for Windows x64 target using the Microsoft compiler. PyInt_FromSsize_t does not exist for Python 2.4 and earlier, so we define a fallback in util.h to use PyInt_FromLong when compiling for Python 2.4.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15511
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
  $ echo "[extensions]" >> $HGRCPATH
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
  $ echo "mq=" >> $HGRCPATH
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     4
  $ tipparents() {
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     5
  > hg parents --template "{rev}:{node|short} {desc|firstline}\n" -r tip
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
  > }
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     8
Test import and merge diffs
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
  $ hg init repo
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
  $ cd repo
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
  $ echo a > a
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    13
  $ hg ci -Am adda
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
  adding a
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    15
  $ echo a >> a
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
  $ hg ci -m changea
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
  $ echo c > c
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    18
  $ hg ci -Am addc
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    19
  adding c
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    20
  $ hg up 0
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    21
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    22
  $ echo b > b
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    23
  $ hg ci -Am addb
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
  adding b
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    25
  created new head
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
  $ hg up 1
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    27
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    28
  $ hg merge 3
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    29
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
  (branch merge, don't forget to commit)
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    31
  $ hg ci -m merge
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    32
  $ hg export . > ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
  $ cd ..
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    34
  $ hg clone -r2 repo repo2
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
  adding changesets
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    36
  adding manifests
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    37
  adding file changes
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    38
  added 3 changesets with 3 changes to 2 files
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
  updating to branch default
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    40
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    41
  $ cd repo2
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
  $ hg pull -r3 ../repo
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
  pulling from ../repo
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
  searching for changes
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
  adding changesets
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    46
  adding manifests
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    47
  adding file changes
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    48
  added 1 changesets with 1 changes to 1 files (+1 heads)
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    49
  (run 'hg heads' to see heads, 'hg merge' to merge)
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    51
Test without --exact and diff.p1 == workingdir.p1
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
  $ hg up 1
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    54
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    55
  $ hg import ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    56
  applying ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
  $ tipparents
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    58
  1:540395c44225 changea
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    59
  3:102a90ea7b4a addb
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    60
  $ hg strip --no-backup tip
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    61
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    62
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    63
Test without --exact and diff.p1 != workingdir.p1
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    64
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    65
  $ hg up 2
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    67
  $ hg import ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    68
  applying ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
  $ tipparents
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    70
  2:890ecaa90481 addc
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    71
  $ hg strip --no-backup tip
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    72
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    74
Test with --exact
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    75
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    76
  $ hg import --exact ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    77
  applying ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    78
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    79
  $ tipparents
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    80
  1:540395c44225 changea
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    81
  3:102a90ea7b4a addb
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    82
  $ hg strip --no-backup tip
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    83
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    84
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    85
Test with --bypass and diff.p1 == workingdir.p1
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    86
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    87
  $ hg up 1
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    88
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    89
  $ hg import --bypass ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    90
  applying ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    91
  $ tipparents
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    92
  1:540395c44225 changea
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    93
  3:102a90ea7b4a addb
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    94
  $ hg strip --no-backup tip
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    95
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    96
Test with --bypass and diff.p1 != workingdir.p1
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    97
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    98
  $ hg up 2
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    99
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   100
  $ hg import --bypass ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   101
  applying ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   102
  $ tipparents
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   103
  2:890ecaa90481 addc
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   104
  $ hg strip --no-backup tip
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   105
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   106
Test with --bypass and --exact
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   107
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   108
  $ hg import --bypass --exact ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   109
  applying ../merge.diff
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   110
  $ tipparents
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   111
  1:540395c44225 changea
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   112
  3:102a90ea7b4a addb
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   113
  $ hg strip --no-backup tip
6cae68a361ed import: fix parent selection when importing merges
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   114