tests/test-convert-darcs.t
author Matt Mackall <mpm@selenic.com>
Sun, 04 Mar 2012 17:14:30 -0600
changeset 16229 5cb2693e1a60
parent 15335 52a137edc060
child 16698 26756d9d8143
permissions -rw-r--r--
merge with stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     2
  $ "$TESTDIR/hghave" darcs || exit 80
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     3
  $ echo "[extensions]" >> $HGRCPATH
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     4
  $ echo "convert=" >> $HGRCPATH
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     5
  $ echo 'graphlog =' >> $HGRCPATH
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     6
  $ DARCS_EMAIL='test@example.org'; export DARCS_EMAIL
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     7
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     8
skip if we can't import elementtree
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    10
  $ mkdir dummy
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    11
  $ mkdir dummy/_darcs
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    12
  $ if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    13
  >     echo 'skipped: missing feature: elementtree module'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    14
  >     exit 80
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    15
  > fi
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    16
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    17
try converting darcs1 repository
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    18
14116
cd3032437064 tests: move test bundles in a bundles/ subdirectory
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13765
diff changeset
    19
  $ hg clone -q "$TESTDIR/bundles/darcs1.hg" darcs
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    20
  $ hg convert -s darcs darcs/darcs1 2>&1 | grep darcs-1.0
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    21
  darcs-1.0 repository format is unsupported, please upgrade
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    22
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    23
initialize darcs repo
5520
cc3af86ab6fe test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5442
diff changeset
    24
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    25
  $ mkdir darcs-repo
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    26
  $ cd darcs-repo
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    27
  $ darcs init
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    28
  $ echo a > a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    29
  $ darcs record -a -l -m p0
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    30
  Finished recording patch 'p0'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    31
  $ cd ..
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    32
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    33
branch and update
12393
84ceedcfeb6a convert/darcs: improve unsupported format detection (issue2172)
Patrick Mezard <pmezard@gmail.com>
parents: 12252
diff changeset
    34
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    35
  $ darcs get darcs-repo darcs-clone >/dev/null
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    36
  $ cd darcs-clone
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    37
  $ echo c >> a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    38
  $ echo c > c
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    39
  $ darcs record -a -l -m p1.1
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    40
  Finished recording patch 'p1.1'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    41
  $ cd ..
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    42
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    43
update source
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    44
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    45
  $ cd darcs-repo
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    46
  $ echo b >> a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    47
  $ echo b > b
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    48
  $ darcs record -a -l -m p1.2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    49
  Finished recording patch 'p1.2'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    50
15335
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    51
  $ darcs pull -a --no-set-default ../darcs-clone
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    52
  Backing up ./a(-darcs-backup0)
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    53
  We have conflicts in the following files:
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    54
  ./a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    55
  Finished pulling and applying.
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    56
  $ sleep 1
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    57
  $ echo e > a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    58
  $ echo f > f
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    59
  $ mkdir dir
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    60
  $ echo d > dir/d
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    61
  $ echo d > dir/d2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    62
  $ darcs record -a -l -m p2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    63
  Finished recording patch 'p2'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    64
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    65
test file and directory move
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    67
  $ darcs mv f ff
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    68
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    69
Test remove + move
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    70
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    71
  $ darcs remove dir/d2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    72
  $ rm dir/d2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    73
  $ darcs mv dir dir2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    74
  $ darcs record -a -l -m p3
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    75
  Finished recording patch 'p3'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    76
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    77
The converter does not currently handle patch conflicts very well.
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    78
When they occur, it reverts *all* changes and moves forward,
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    79
letting the conflict resolving patch fix collisions.
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    80
Unfortunately, non-conflicting changes, like the addition of the
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    81
"c" file in p1.1 patch are reverted too.
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    82
Just to say that manifest not listing "c" here is a bug.
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    83
15335
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    84
  $ cd ..
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    85
  $ hg convert darcs-repo darcs-repo-hg
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    86
  initializing destination darcs-repo-hg repository
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    87
  scanning source...
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    88
  sorting...
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    89
  converting...
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    90
  4 p0
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    91
  3 p1.2
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    92
  2 p1.1
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    93
  1 p2
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    94
  0 p3
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    95
  $ hg log -R darcs-repo-hg -g --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@"
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    96
  4 "p3" (test@example.org) files: dir/d dir/d2 dir2/d f ff
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    97
  3 "p2" (test@example.org) files: a dir/d dir/d2 f
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    98
  2 "p1.1" (test@example.org) files: 
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
    99
  1 "p1.2" (test@example.org) files: a b
52a137edc060 tests: darcs > 2.5 got "smart" about encoding, disable encoding tests
Matt Mackall <mpm@selenic.com>
parents: 14116
diff changeset
   100
  0 "p0" (test@example.org) files: a
12718
372abc799caa merge with stable
Matt Mackall <mpm@selenic.com>
parents: 12717 12524
diff changeset
   101
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   102
  $ hg up -q -R darcs-repo-hg
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   103
  $ hg -R darcs-repo-hg manifest --debug
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   104
  7225b30cdf38257d5cc7780772c051b6f33e6d6b 644   a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   105
  1e88685f5ddec574a34c70af492f95b6debc8741 644   b
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   106
  37406831adc447ec2385014019599dfec953c806 644   dir2/d
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   107
  b783a337463792a5c7d548ad85a7d3253c16ba8c 644   ff