tests/test-convert-tagsbranch-topology.t
author Eduard-Cristian Stefan <alexandrul.ct@gmail.com>
Fri, 08 Jun 2012 05:31:28 +0300
changeset 16892 cfd892b7569f
parent 13756 6b7077df4aa5
child 16913 f2719b387380
permissions -rw-r--r--
test-convert: disable autocrlf for git Git might have autocrlf=true as a global or default setting, especially on windows. That is not expected in the tests and can cause + warning: LF will be replaced by CRLF in d/b. + The file will have its original line endings in your working directory. Explicitly setting it false will make the test pass in some setups - but still not out of the box.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
     2
  $ "$TESTDIR/hghave" git || exit 80
16892
cfd892b7569f test-convert: disable autocrlf for git
Eduard-Cristian Stefan <alexandrul.ct@gmail.com>
parents: 13756
diff changeset
     3
  $ echo "[core]" >> $HOME/.gitconfig
cfd892b7569f test-convert: disable autocrlf for git
Eduard-Cristian Stefan <alexandrul.ct@gmail.com>
parents: 13756
diff changeset
     4
  $ echo "autocrlf = false" >> $HOME/.gitconfig
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
     5
  $ echo "[extensions]" >> $HGRCPATH
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
     6
  $ echo "convert=" >> $HGRCPATH
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
     7
  $ echo 'hgext.graphlog =' >> $HGRCPATH
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
     8
  $ echo '[convert]' >> $HGRCPATH
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
     9
  $ echo 'hg.usebranchnames = True' >> $HGRCPATH
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    10
  $ echo 'hg.tagsbranch = tags-update' >> $HGRCPATH
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    11
  $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    12
  $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    13
  $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    14
  $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    15
  $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    16
  $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    17
  $ count=10
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    18
  $ action()
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    19
  > {
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    20
  >     GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    21
  >     GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    22
  >     git "$@" >/dev/null 2>/dev/null || echo "git command error"
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    23
  >     count=`expr $count + 1`
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    24
  > }
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    25
  $ glog()
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    26
  > {
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    27
  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    28
  > }
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    29
  $ convertrepo()
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    30
  > {
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    31
  >     hg convert --datesort git-repo hg-repo
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    32
  > }
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    33
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    34
Build a GIT repo with at least 1 tag
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    35
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    36
  $ mkdir git-repo
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    37
  $ cd git-repo
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    38
  $ git init >/dev/null 2>&1
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    39
  $ echo a > a
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    40
  $ git add a
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    41
  $ action commit -m "rev1"
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    42
  $ action tag -m "tag1" tag1
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    43
  $ cd ..
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    44
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    45
Do a first conversion
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    46
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    47
  $ convertrepo
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    48
  initializing destination hg-repo repository
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    49
  scanning source...
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    50
  sorting...
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    51
  converting...
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    52
  0 rev1
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    53
  updating tags
13756
6b7077df4aa5 convert: add bookmarks reading support to git backend
Edouard Gomez <ed.gomez@free.fr>
parents: 12534
diff changeset
    54
  updating bookmarks
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    55
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    56
Simulate upstream  updates after first conversion
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    57
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    58
  $ cd git-repo
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    59
  $ echo b > a
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    60
  $ git add a
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    61
  $ action commit -m "rev2"
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    62
  $ action tag -m "tag2" tag2
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    63
  $ cd ..
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    64
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    65
Perform an incremental conversion
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    66
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    67
  $ convertrepo
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    68
  scanning source...
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    69
  sorting...
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    70
  converting...
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    71
  0 rev2
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    72
  updating tags
13756
6b7077df4aa5 convert: add bookmarks reading support to git backend
Edouard Gomez <ed.gomez@free.fr>
parents: 12534
diff changeset
    73
  updating bookmarks
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    74
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    75
Print the log
9431
d1b135f2f415 convert: fix history topology when using hg.tagsbranch
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    76
12534
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    77
  $ cd hg-repo
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    78
  $ glog
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    79
  o  3 "update tags" files: .hgtags
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    80
  |
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    81
  | o  2 "rev2" files: a
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    82
  | |
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    83
  o |  1 "update tags" files: .hgtags
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    84
   /
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    85
  o  0 "rev1" files: a
3ee3d7634e94 tests: unify test-convert-tagsbranch-topology
Matt Mackall <mpm@selenic.com>
parents: 9431
diff changeset
    86