tests/test-convert-hg-svn.t
author Pulkit Goyal <7895pulkit@gmail.com>
Mon, 05 Feb 2018 13:12:01 +0530
changeset 35917 3d8b0020f470
parent 28533 dfd5a6830ea7
child 39707 5abc47d4ca6b
permissions -rw-r--r--
py3: use pycompat.strkwargs() to convert kwargs' key to str Differential Revision: https://phab.mercurial-scm.org/D2043
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 20419
diff changeset
     1
#require svn svn-bindings
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     2
28469
b65481675466 tests: stabilize svn output
timeless <timeless@mozdev.org>
parents: 23172
diff changeset
     3
  $ filter_svn_output () {
28533
dfd5a6830ea7 tests: make tests for convert with svn portable
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 28469
diff changeset
     4
  >     egrep -v 'Committing|Updating|(^$)' | sed -e 's/done$//' || true
28469
b65481675466 tests: stabilize svn output
timeless <timeless@mozdev.org>
parents: 23172
diff changeset
     5
  > }
b65481675466 tests: stabilize svn output
timeless <timeless@mozdev.org>
parents: 23172
diff changeset
     6
23172
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22947
diff changeset
     7
  $ cat <<EOF >> $HGRCPATH
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22947
diff changeset
     8
  > [extensions]
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22947
diff changeset
     9
  > convert =
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22947
diff changeset
    10
  > mq =
e955549cd045 tests: write hgrc of more than two lines by using shell heredoc
Yuya Nishihara <yuya@tcha.org>
parents: 22947
diff changeset
    11
  > EOF
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    12
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    13
  $ SVNREPOPATH=`pwd`/svn-repo
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    14
#if windows
22947
c63a09b6b337 tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents: 22046
diff changeset
    15
  $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    16
#else
22947
c63a09b6b337 tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents: 22046
diff changeset
    17
  $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    18
#endif
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    19
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    20
  $ svnadmin create "$SVNREPOPATH"
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    21
  $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change <<EOF
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    22
  > #!/bin/sh
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    23
  > 
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    24
  > REPOS="$1"
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    25
  > REV="$2"
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    26
  > USER="$3"
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    27
  > PROPNAME="$4"
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    28
  > ACTION="$5"
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    29
  > 
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    30
  > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    31
  > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    32
  > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    33
  > 
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    34
  > echo "Changing prohibited revision property" >&2
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    35
  > exit 1
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    36
  > EOF
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    37
  $ chmod +x "$SVNREPOPATH"/hooks/pre-revprop-change
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    38
  $ svn co "$SVNREPOURL" "$SVNREPOPATH"-wc
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    39
  Checked out revision 0.
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    40
  $ cd "$SVNREPOPATH"-wc
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    41
  $ echo a > a
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    42
  $ svn add a
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    43
  A         a
28469
b65481675466 tests: stabilize svn output
timeless <timeless@mozdev.org>
parents: 23172
diff changeset
    44
  $ svn ci -m'added a' a | filter_svn_output
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    45
  Adding         a
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    46
  Transmitting file data .
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    47
  Committed revision 1.
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    48
  $ cd ..
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    49
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    50
initial roundtrip
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    51
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    52
  $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg | grep -v initializing
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    53
  scanning source...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    54
  sorting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    55
  converting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    56
  0 added a
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    57
  $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    58
  scanning source...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    59
  sorting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    60
  converting...
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    61
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    62
second roundtrip should do nothing
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    63
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    64
  $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    65
  scanning source...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    66
  sorting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    67
  converting...
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    68
  $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    69
  scanning source...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    70
  sorting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    71
  converting...
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    72
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    73
new hg rev
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    74
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    75
  $ hg clone "$SVNREPOPATH"-hg "$SVNREPOPATH"-work
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    76
  updating to branch default
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    77
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    78
  $ cd "$SVNREPOPATH"-work
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    79
  $ echo b > b
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    80
  $ hg add b
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    81
  $ hg ci -mb
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    82
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    83
adding an empty revision
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    84
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    85
  $ hg qnew -m emtpy empty
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    86
  $ hg qfinish -a
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    87
  $ cd ..
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    88
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    89
echo hg to svn
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    90
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    91
  $ hg --cwd "$SVNREPOPATH"-hg pull -q "$SVNREPOPATH"-work
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
    92
  $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    93
  scanning source...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    94
  sorting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    95
  converting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    96
  1 b
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    97
  0 emtpy
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    98
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
    99
svn back to hg should do nothing
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
   100
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
   101
  $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   102
  scanning source...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   103
  sorting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   104
  converting...
5554
2147a734dcf9 convert: tell the source repository when a rev has been converted
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
   105
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   106
hg back to svn should do nothing
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   107
17033
0413f68da85c tests: cleanup of svn url handling
Mads Kiilerich <mads@kiilerich.com>
parents: 12527
diff changeset
   108
  $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
12527
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   109
  scanning source...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   110
  sorting...
9a0528fd9172 tests: unify test-convert-hg-svn
Matt Mackall <mpm@selenic.com>
parents: 10775
diff changeset
   111
  converting...
20419
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   112
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   113
verify which shamap format we are storing and must be able to handle
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   114
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   115
  $ cat svn-repo-hg/.hg/shamap
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   116
  svn:????????-????-????-????-????????????@1 ???????????????????????????????????????? (glob)
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   117
  svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   118
  svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   119
  $ cat svn-repo-wc/.svn/hg-shamap
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   120
  ???????????????????????????????????????? 1 (glob)
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   121
  ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
e61a8395c3c1 convert: make subversion revsplit more stable when meeting revisions without @
Mads Kiilerich <madski@unity3d.com>
parents: 17033
diff changeset
   122
  ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)