tests/test-convert-clonebranches.t
author David Soria Parra <dsp@experimentalworks.net>
Thu, 29 Aug 2013 09:22:13 -0700
changeset 19854 49d4919d21c2
parent 18373 687ed69f6fdf
child 23172 e955549cd045
permissions -rw-r--r--
shelve: add a shelve extension to save/restore working changes This extension saves shelved changes using a temporary draft commit, and bundles the temporary commit and its draft ancestors, then strips them. This strategy makes it possible to use Mercurial's bundle and merge machinery to resolve conflicts if necessary when unshelving, even when the destination commit or its ancestors have been amended, squashed, or evolved. (Once a change has been unshelved, its associated unbundled commits are either rolled back or stripped.) Storing the shelved change as a bundle also avoids the difficulty that hidden commits would cause, of making it impossible to amend the parent if it is a draft commits (a common scenario). Although this extension shares its name and some functionality with the third party hgshelve extension, it has little else in common. Notably, the hgshelve extension shelves changes as unified diffs, which makes conflict resolution a matter of finding .rej files and conflict markers, and cleaning up the mess by hand. We do not yet allow hunk-level choosing of changes to record. Compared to the hgshelve extension, this is a small regression in usability, but we hope to integrate that at a later point, once the record machinery becomes more reusable and robust.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     2
  $ echo "[extensions]" >> $HGRCPATH
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     3
  $ echo "convert = " >> $HGRCPATH
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     4
  $ echo "[convert]" >> $HGRCPATH
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     5
  $ echo "hg.tagsbranch=0" >> $HGRCPATH
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     6
  $ hg init source
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     7
  $ cd source
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     8
  $ echo a > a
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     9
  $ hg ci -qAm adda
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    10
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    11
Add a merge with one parent in the same branch
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    12
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    13
  $ echo a >> a
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    14
  $ hg ci -qAm changea
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    15
  $ hg up -qC 0
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    16
  $ hg branch branch0
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    17
  marked working directory as branch branch0
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 12518
diff changeset
    18
  (branches are permanent and global, did you want a bookmark?)
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    19
  $ echo b > b
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    20
  $ hg ci -qAm addb
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    21
  $ hg up -qC
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    22
  $ hg merge default
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    23
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    24
  (branch merge, don't forget to commit)
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    25
  $ hg ci -qm mergeab
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    26
  $ hg tag -ql mergeab
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    27
  $ cd ..
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    28
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    29
Miss perl... sometimes
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    30
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    31
  $ cat > filter.py <<EOF
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    32
  > import sys, re
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    33
  > 
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    34
  > r = re.compile(r'^(?:\d+|pulling from)')
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    35
  > sys.stdout.writelines([l for l in sys.stdin if r.search(l)])
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    36
  > EOF
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    37
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    38
convert
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    40
  $ hg convert -v --config convert.hg.clonebranches=1 source dest |
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    41
  >     python filter.py
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    42
  3 adda
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    43
  2 changea
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    44
  1 addb
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    45
  pulling from default into branch0
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    46
  1 changesets found
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    47
  0 mergeab
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    48
  pulling from default into branch0
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    49
  1 changesets found
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    51
Add a merge with both parents and child in different branches
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    52
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    53
  $ cd source
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    54
  $ hg branch branch1
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    55
  marked working directory as branch branch1
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 12518
diff changeset
    56
  (branches are permanent and global, did you want a bookmark?)
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    57
  $ echo a > file1
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    58
  $ hg ci -qAm c1
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    59
  $ hg up -qC mergeab
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    60
  $ hg branch branch2
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    61
  marked working directory as branch branch2
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 12518
diff changeset
    62
  (branches are permanent and global, did you want a bookmark?)
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    63
  $ echo a > file2
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    64
  $ hg ci -qAm c2
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    65
  $ hg merge branch1
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    66
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    67
  (branch merge, don't forget to commit)
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    68
  $ hg branch branch3
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    69
  marked working directory as branch branch3
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 12518
diff changeset
    70
  (branches are permanent and global, did you want a bookmark?)
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    71
  $ hg ci -qAm c3
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    72
  $ cd ..
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    73
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    74
incremental conversion
5934
e495f3f35b2d convert: hg.clonebranches must pull missing parents (issue941)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    75
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    76
  $ hg convert -v --config convert.hg.clonebranches=1 source dest |
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    77
  >     python filter.py
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    78
  2 c1
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    79
  pulling from branch0 into branch1
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    80
  4 changesets found
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    81
  1 c2
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    82
  pulling from branch0 into branch2
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    83
  4 changesets found
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    84
  0 c3
18373
687ed69f6fdf convert: process missing branches in sorted order
Mads Kiilerich <mads@kiilerich.com>
parents: 15615
diff changeset
    85
  pulling from branch1 into branch3
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    86
  5 changesets found
18373
687ed69f6fdf convert: process missing branches in sorted order
Mads Kiilerich <mads@kiilerich.com>
parents: 15615
diff changeset
    87
  pulling from branch2 into branch3
12518
89f1210a1238 tests: unify test-convert-clonebranches
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    88
  1 changesets found