tests/test-git-import
branchstable
changeset 10928 377d879e9d1b
parent 10061 9e2ab10728a2
child 12574 77600d697d0e
equal deleted inserted replaced
10927:c1d375e93ee8 10928:377d879e9d1b
     2 
     2 
     3 hg init a
     3 hg init a
     4 cd a
     4 cd a
     5 
     5 
     6 echo % new file
     6 echo % new file
     7 hg import -mnew - <<EOF
     7 hg import -d "1000000 0" -mnew - <<EOF
     8 diff --git a/new b/new
     8 diff --git a/new b/new
     9 new file mode 100644
     9 new file mode 100644
    10 index 0000000..7898192
    10 index 0000000..7898192
    11 --- /dev/null
    11 --- /dev/null
    12 +++ b/new
    12 +++ b/new
    13 @@ -0,0 +1 @@
    13 @@ -0,0 +1 @@
    14 +a
    14 +a
    15 EOF
    15 EOF
       
    16 hg tip -q
    16 
    17 
    17 echo % new empty file
    18 echo % new empty file
    18 hg import -mempty - <<EOF
    19 hg import -d "1000000 0" -mempty - <<EOF
    19 diff --git a/empty b/empty
    20 diff --git a/empty b/empty
    20 new file mode 100644
    21 new file mode 100644
    21 EOF
    22 EOF
       
    23 hg tip -q
    22 hg locate empty
    24 hg locate empty
    23 
    25 
    24 echo % chmod +x
    26 echo % chmod +x
    25 hg import -msetx - <<EOF
    27 hg import -d "1000000 0" -msetx - <<EOF
    26 diff --git a/new b/new
    28 diff --git a/new b/new
    27 old mode 100644
    29 old mode 100644
    28 new mode 100755
    30 new mode 100755
    29 EOF
    31 EOF
       
    32 hg tip -q
    30 
    33 
    31 test -x new || echo failed
    34 test -x new || echo failed
    32 
    35 
    33 echo % copy
    36 echo % copy
    34 hg import -mcopy - <<EOF
    37 hg import -d "1000000 0" -mcopy - <<EOF
    35 diff --git a/new b/copy
    38 diff --git a/new b/copy
    36 old mode 100755
    39 old mode 100755
    37 new mode 100644
    40 new mode 100644
    38 similarity index 100%
    41 similarity index 100%
    39 copy from new
    42 copy from new
    41 diff --git a/new b/copyx
    44 diff --git a/new b/copyx
    42 similarity index 100%
    45 similarity index 100%
    43 copy from new
    46 copy from new
    44 copy to copyx
    47 copy to copyx
    45 EOF
    48 EOF
       
    49 hg tip -q
    46 
    50 
    47 if "$TESTDIR/hghave" -q execbit; then
    51 if "$TESTDIR/hghave" -q execbit; then
    48     test -f copy -a ! -x copy || echo failed
    52     test -f copy -a ! -x copy || echo failed
    49     test -x copyx || echo failed
    53     test -x copyx || echo failed
    50 else
    54 else
    52 fi
    56 fi
    53 cat copy
    57 cat copy
    54 hg cat copy
    58 hg cat copy
    55 
    59 
    56 echo % rename
    60 echo % rename
    57 hg import -mrename - <<EOF
    61 hg import -d "1000000 0" -mrename - <<EOF
    58 diff --git a/copy b/rename
    62 diff --git a/copy b/rename
    59 similarity index 100%
    63 similarity index 100%
    60 rename from copy
    64 rename from copy
    61 rename to rename
    65 rename to rename
    62 EOF
    66 EOF
       
    67 hg tip -q
    63 
    68 
    64 hg locate
    69 hg locate
    65 
    70 
    66 echo % delete
    71 echo % delete
    67 hg import -mdelete - <<EOF
    72 hg import -d "1000000 0" -mdelete - <<EOF
    68 diff --git a/copyx b/copyx
    73 diff --git a/copyx b/copyx
    69 deleted file mode 100755
    74 deleted file mode 100755
    70 index 7898192..0000000
    75 index 7898192..0000000
    71 --- a/copyx
    76 --- a/copyx
    72 +++ /dev/null
    77 +++ /dev/null
    73 @@ -1 +0,0 @@
    78 @@ -1 +0,0 @@
    74 -a
    79 -a
    75 EOF
    80 EOF
       
    81 hg tip -q
    76 
    82 
    77 hg locate
    83 hg locate
    78 test -f copyx && echo failed || true
    84 test -f copyx && echo failed || true
    79 
    85 
    80 echo % regular diff
    86 echo % regular diff
    81 hg import -mregular - <<EOF
    87 hg import -d "1000000 0" -mregular - <<EOF
    82 diff --git a/rename b/rename
    88 diff --git a/rename b/rename
    83 index 7898192..72e1fe3 100644
    89 index 7898192..72e1fe3 100644
    84 --- a/rename
    90 --- a/rename
    85 +++ b/rename
    91 +++ b/rename
    86 @@ -1 +1,5 @@
    92 @@ -1 +1,5 @@
    88 +a
    94 +a
    89 +a
    95 +a
    90 +a
    96 +a
    91 +a
    97 +a
    92 EOF
    98 EOF
       
    99 hg tip -q
    93 
   100 
    94 echo % copy and modify
   101 echo % copy and modify
    95 hg import -mcopymod - <<EOF
   102 hg import -d "1000000 0" -mcopymod - <<EOF
    96 diff --git a/rename b/copy2
   103 diff --git a/rename b/copy2
    97 similarity index 80%
   104 similarity index 80%
    98 copy from rename
   105 copy from rename
    99 copy to copy2
   106 copy to copy2
   100 index 72e1fe3..b53c148 100644
   107 index 72e1fe3..b53c148 100644
   106 -a
   113 -a
   107 +b
   114 +b
   108  a
   115  a
   109  a
   116  a
   110 EOF
   117 EOF
       
   118 hg tip -q
   111 
   119 
   112 hg cat copy2
   120 hg cat copy2
   113 
   121 
   114 echo % rename and modify
   122 echo % rename and modify
   115 hg import -mrenamemod - <<EOF
   123 hg import -d "1000000 0" -mrenamemod - <<EOF
   116 diff --git a/copy2 b/rename2
   124 diff --git a/copy2 b/rename2
   117 similarity index 80%
   125 similarity index 80%
   118 rename from copy2
   126 rename from copy2
   119 rename to rename2
   127 rename to rename2
   120 index b53c148..8f81e29 100644
   128 index b53c148..8f81e29 100644
   126  b
   134  b
   127 -a
   135 -a
   128 +c
   136 +c
   129  a
   137  a
   130 EOF
   138 EOF
       
   139 hg tip -q
   131 
   140 
   132 hg locate copy2
   141 hg locate copy2
   133 hg cat rename2
   142 hg cat rename2
   134 
   143 
   135 echo % one file renamed multiple times
   144 echo % one file renamed multiple times
   136 hg import -mmultirenames - <<EOF
   145 hg import -d "1000000 0" -mmultirenames - <<EOF
   137 diff --git a/rename2 b/rename3
   146 diff --git a/rename2 b/rename3
   138 rename from rename2
   147 rename from rename2
   139 rename to rename3
   148 rename to rename3
   140 diff --git a/rename2 b/rename3-2
   149 diff --git a/rename2 b/rename3-2
   141 rename from rename2
   150 rename from rename2
   142 rename to rename3-2
   151 rename to rename3-2
   143 EOF
   152 EOF
       
   153 hg tip -q
   144 hg log -vr. --template '{rev} {files} / {file_copies}\n'
   154 hg log -vr. --template '{rev} {files} / {file_copies}\n'
   145 
   155 
   146 hg locate rename2 rename3 rename3-2
   156 hg locate rename2 rename3 rename3-2
   147 hg cat rename3
   157 hg cat rename3
   148 echo
   158 echo
   150 
   160 
   151 echo foo > foo
   161 echo foo > foo
   152 hg add foo
   162 hg add foo
   153 hg ci -m 'add foo'
   163 hg ci -m 'add foo'
   154 echo % binary files and regular patch hunks
   164 echo % binary files and regular patch hunks
   155 hg import -m binaryregular - <<EOF
   165 hg import -d "1000000 0" -m binaryregular - <<EOF
   156 diff --git a/binary b/binary
   166 diff --git a/binary b/binary
   157 new file mode 100644
   167 new file mode 100644
   158 index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
   168 index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
   159 GIT binary patch
   169 GIT binary patch
   160 literal 4
   170 literal 4
   162 
   172 
   163 diff --git a/foo b/foo2
   173 diff --git a/foo b/foo2
   164 rename from foo
   174 rename from foo
   165 rename to foo2
   175 rename to foo2
   166 EOF
   176 EOF
       
   177 hg tip -q
   167 cat foo2
   178 cat foo2
   168 hg manifest --debug | grep binary
   179 hg manifest --debug | grep binary
   169 
   180 
   170 echo % many binary files
   181 echo % many binary files
   171 hg import -m multibinary - <<EOF
   182 hg import -d "1000000 0" -m multibinary - <<EOF
   172 diff --git a/mbinary1 b/mbinary1
   183 diff --git a/mbinary1 b/mbinary1
   173 new file mode 100644
   184 new file mode 100644
   174 index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
   185 index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
   175 GIT binary patch
   186 GIT binary patch
   176 literal 4
   187 literal 4
   182 GIT binary patch
   193 GIT binary patch
   183 literal 5
   194 literal 5
   184 Mc\${NkU|\`?^000jF3jhEB
   195 Mc\${NkU|\`?^000jF3jhEB
   185 
   196 
   186 EOF
   197 EOF
       
   198 hg tip -q
   187 hg manifest --debug | grep mbinary
   199 hg manifest --debug | grep mbinary
   188 
   200 
   189 echo % filenames with spaces
   201 echo % filenames with spaces
   190 hg import -m spaces - <<EOF
   202 hg import -d "1000000 0" -m spaces - <<EOF
   191 diff --git a/foo bar b/foo bar
   203 diff --git a/foo bar b/foo bar
   192 new file mode 100644
   204 new file mode 100644
   193 index 0000000..257cc56
   205 index 0000000..257cc56
   194 --- /dev/null
   206 --- /dev/null
   195 +++ b/foo bar	
   207 +++ b/foo bar	
   196 @@ -0,0 +1 @@
   208 @@ -0,0 +1 @@
   197 +foo
   209 +foo
   198 EOF
   210 EOF
       
   211 hg tip -q
   199 cat "foo bar"
   212 cat "foo bar"
   200 
   213 
   201 echo % copy then modify the original file
   214 echo % copy then modify the original file
   202 hg import -m copy-mod-orig - <<EOF
   215 hg import -d "1000000 0" -m copy-mod-orig - <<EOF
   203 diff --git a/foo2 b/foo2
   216 diff --git a/foo2 b/foo2
   204 index 257cc56..fe08ec6 100644
   217 index 257cc56..fe08ec6 100644
   205 --- a/foo2
   218 --- a/foo2
   206 +++ b/foo2
   219 +++ b/foo2
   207 @@ -1 +1,2 @@
   220 @@ -1 +1,2 @@
   210 diff --git a/foo2 b/foo3
   223 diff --git a/foo2 b/foo3
   211 similarity index 100%
   224 similarity index 100%
   212 copy from foo2
   225 copy from foo2
   213 copy to foo3
   226 copy to foo3
   214 EOF
   227 EOF
       
   228 hg tip -q
   215 
   229 
   216 cat foo3
   230 cat foo3