tests/test-convert-darcs.t
author Erik Zielke <ez@aragost.com>
Thu, 23 Sep 2010 15:18:10 +0200
changeset 12539 dece1f46f7a2
parent 12524 8773cac3a455
child 12718 372abc799caa
permissions -rw-r--r--
mq: removed return from callers to patchheader.qseries Some callers to patchheader.qseries returned the value further, but pathcheader.qseries does not explicitly return anything. It was confusing this was returned further
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
  $ HOME=`pwd`/do_not_use_HOME_darcs; export HOME
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     8
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
     9
skip if we can't import elementtree
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    10
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    11
  $ mkdir dummy
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    12
  $ mkdir dummy/_darcs
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    13
  $ 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
    14
  >     echo 'skipped: missing feature: elementtree module'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    15
  >     exit 80
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    16
  > fi
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    17
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    18
try converting darcs1 repository
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    19
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    20
  $ hg clone -q "$TESTDIR/darcs1.hg" darcs
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    21
  $ 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
    22
  darcs-1.0 repository format is unsupported, please upgrade
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    23
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    24
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
    25
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    26
  $ mkdir darcs-repo
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    27
  $ cd darcs-repo
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    28
  $ darcs init
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    29
  $ echo a > a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    30
  $ darcs record -a -l -m p0
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    31
  Finished recording patch 'p0'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    32
  $ cd ..
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    33
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    34
branch and update
12393
84ceedcfeb6a convert/darcs: improve unsupported format detection (issue2172)
Patrick Mezard <pmezard@gmail.com>
parents: 12252
diff changeset
    35
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    36
  $ darcs get darcs-repo darcs-clone >/dev/null
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    37
  $ cd darcs-clone
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    38
  $ echo c >> a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    39
  $ echo c > c
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    40
  $ darcs record -a -l -m p1.1
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    41
  Finished recording patch 'p1.1'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    42
  $ cd ..
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    43
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    44
update source
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    45
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    46
  $ cd darcs-repo
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    47
  $ echo b >> a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    48
  $ echo b > b
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    49
  $ darcs record -a -l -m p1.2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    50
  Finished recording patch 'p1.2'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    51
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    52
merge branch
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    53
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    54
  $ darcs pull -a ../darcs-clone
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    55
  Backing up ./a(-darcs-backup0)
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    56
  We have conflicts in the following files:
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    57
  ./a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    58
  Finished pulling and applying.
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    59
  $ sleep 1
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    60
  $ echo e > a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    61
  $ echo f > f
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    62
  $ mkdir dir
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    63
  $ echo d > dir/d
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    64
  $ echo d > dir/d2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    65
  $ darcs record -a -l -m p2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    66
  Finished recording patch 'p2'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    67
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    68
test file and directory move
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    69
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    70
  $ darcs mv f ff
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    71
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    72
Test remove + move
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    73
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    74
  $ darcs remove dir/d2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    75
  $ rm dir/d2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    76
  $ darcs mv dir dir2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    77
  $ darcs record -a -l -m p3
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    78
  Finished recording patch 'p3'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    79
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    80
test utf-8 commit message and author
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    81
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    82
  $ echo g > g
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    83
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    84
darcs is encoding agnostic, so it takes whatever bytes it's given
9526
457a30ed8ffb convert/darcs: fix file renaming (issue1853)
Patrick Mezard <pmezard@gmail.com>
parents: 9326
diff changeset
    85
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    86
  $ darcs record -a -l -m 'p4: desc ñ' -A 'author ñ'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    87
  Finished recording patch 'p4: desc ñ'
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    88
  $ glog()
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    89
  > {
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    90
  >     HGENCODING=utf-8 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@"
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    91
  > }
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    92
  $ cd ..
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    93
  $ hg convert darcs-repo darcs-repo-hg
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    94
  initializing destination darcs-repo-hg repository
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    95
  scanning source...
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    96
  sorting...
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    97
  converting...
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    98
  5 p0
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
    99
  4 p1.2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   100
  3 p1.1
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   101
  2 p2
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   102
  1 p3
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   103
  0 p4: desc ?
5413
719fd175181f Test darcs converter
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   104
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   105
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
   106
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
   107
letting the conflict resolving patch fix collisions.
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   108
Unfortunately, non-conflicting changes, like the addition of the
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   109
"c" file in p1.1 patch are reverted too.
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   110
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
   111
12524
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   112
  $ glog -R darcs-repo-hg
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   113
  o  5 "p4: desc ñ" (author ñ) files: g
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   114
  |
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   115
  o  4 "p3" (test@example.org) files: dir/d dir/d2 dir2/d f ff
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   116
  |
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   117
  o  3 "p2" (test@example.org) files: a dir/d dir/d2 f
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   118
  |
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   119
  o  2 "p1.1" (test@example.org) files:
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   120
  |
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   121
  o  1 "p1.2" (test@example.org) files: a b
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   122
  |
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   123
  o  0 "p0" (test@example.org) files: a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   124
  
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   125
  $ hg up -q -R darcs-repo-hg
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   126
  $ hg -R darcs-repo-hg manifest --debug
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   127
  7225b30cdf38257d5cc7780772c051b6f33e6d6b 644   a
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   128
  1e88685f5ddec574a34c70af492f95b6debc8741 644   b
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   129
  37406831adc447ec2385014019599dfec953c806 644   dir2/d
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   130
  b783a337463792a5c7d548ad85a7d3253c16ba8c 644   ff
8773cac3a455 tests: unify test-convert-darcs
Matt Mackall <mpm@selenic.com>
parents: 12407
diff changeset
   131
  0973eb1b2ecc4de7fafe7447ce1b7462108b4848 644   g