test-git-import
230 lines
| 3.8 KiB
| text/plain
|
TextLexer
/ tests / test-git-import
Brendan Cully
|
r2864 | #!/bin/sh | ||
hg init a | ||||
cd a | ||||
echo % new file | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mnew - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/new b/new | ||
new file mode 100644 | ||||
index 0000000..7898192 | ||||
--- /dev/null | ||||
+++ b/new | ||||
@@ -0,0 +1 @@ | ||||
+a | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
Brendan Cully
|
r3589 | echo % new empty file | ||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mempty - <<EOF | ||
Brendan Cully
|
r3589 | diff --git a/empty b/empty | ||
new file mode 100644 | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r3589 | hg locate empty | ||
Brendan Cully
|
r2864 | echo % chmod +x | ||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -msetx - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/new b/new | ||
old mode 100644 | ||||
new mode 100755 | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
test -x new || echo failed | ||||
echo % copy | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mcopy - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/new b/copy | ||
old mode 100755 | ||||
new mode 100644 | ||||
similarity index 100% | ||||
copy from new | ||||
copy to copy | ||||
diff --git a/new b/copyx | ||||
similarity index 100% | ||||
copy from new | ||||
copy to copyx | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
Patrick Mezard
|
r5073 | if "$TESTDIR/hghave" -q execbit; then | ||
test -f copy -a ! -x copy || echo failed | ||||
test -x copyx || echo failed | ||||
else | ||||
test -f copy || echo failed | ||||
fi | ||||
Brendan Cully
|
r2864 | cat copy | ||
hg cat copy | ||||
echo % rename | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mrename - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/copy b/rename | ||
similarity index 100% | ||||
rename from copy | ||||
rename to rename | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
hg locate | ||||
echo % delete | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mdelete - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/copyx b/copyx | ||
deleted file mode 100755 | ||||
index 7898192..0000000 | ||||
--- a/copyx | ||||
+++ /dev/null | ||||
@@ -1 +0,0 @@ | ||||
-a | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
hg locate | ||||
test -f copyx && echo failed || true | ||||
echo % regular diff | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mregular - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/rename b/rename | ||
index 7898192..72e1fe3 100644 | ||||
--- a/rename | ||||
+++ b/rename | ||||
@@ -1 +1,5 @@ | ||||
a | ||||
+a | ||||
+a | ||||
+a | ||||
+a | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
echo % copy and modify | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mcopymod - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/rename b/copy2 | ||
similarity index 80% | ||||
copy from rename | ||||
copy to copy2 | ||||
index 72e1fe3..b53c148 100644 | ||||
--- a/rename | ||||
+++ b/copy2 | ||||
@@ -1,5 +1,5 @@ | ||||
a | ||||
a | ||||
-a | ||||
+b | ||||
a | ||||
a | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
hg cat copy2 | ||||
echo % rename and modify | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mrenamemod - <<EOF | ||
Brendan Cully
|
r2864 | diff --git a/copy2 b/rename2 | ||
similarity index 80% | ||||
rename from copy2 | ||||
rename to rename2 | ||||
index b53c148..8f81e29 100644 | ||||
--- a/copy2 | ||||
+++ b/rename2 | ||||
@@ -1,5 +1,5 @@ | ||||
a | ||||
a | ||||
b | ||||
-a | ||||
+c | ||||
a | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Brendan Cully
|
r2864 | |||
hg locate copy2 | ||||
hg cat rename2 | ||||
Alexis S. L. Carvalho
|
r3701 | |||
echo % one file renamed multiple times | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -mmultirenames - <<EOF | ||
Alexis S. L. Carvalho
|
r3701 | diff --git a/rename2 b/rename3 | ||
rename from rename2 | ||||
rename to rename3 | ||||
diff --git a/rename2 b/rename3-2 | ||||
rename from rename2 | ||||
rename to rename3-2 | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Patrick Mezard
|
r10061 | hg log -vr. --template '{rev} {files} / {file_copies}\n' | ||
Alexis S. L. Carvalho
|
r3701 | |||
hg locate rename2 rename3 rename3-2 | ||||
hg cat rename3 | ||||
echo | ||||
hg cat rename3-2 | ||||
Alexis S. L. Carvalho
|
r3716 | |||
echo foo > foo | ||||
hg add foo | ||||
hg ci -m 'add foo' | ||||
echo % binary files and regular patch hunks | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -m binaryregular - <<EOF | ||
Alexis S. L. Carvalho
|
r3716 | diff --git a/binary b/binary | ||
new file mode 100644 | ||||
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 | ||||
GIT binary patch | ||||
literal 4 | ||||
Lc\${NkU|;|M00aO5 | ||||
diff --git a/foo b/foo2 | ||||
rename from foo | ||||
rename to foo2 | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Alexis S. L. Carvalho
|
r3716 | cat foo2 | ||
Matt Mackall
|
r3736 | hg manifest --debug | grep binary | ||
Alexis S. L. Carvalho
|
r3717 | |||
echo % many binary files | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -m multibinary - <<EOF | ||
Alexis S. L. Carvalho
|
r3717 | diff --git a/mbinary1 b/mbinary1 | ||
new file mode 100644 | ||||
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 | ||||
GIT binary patch | ||||
literal 4 | ||||
Lc\${NkU|;|M00aO5 | ||||
diff --git a/mbinary2 b/mbinary2 | ||||
new file mode 100644 | ||||
index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490 | ||||
GIT binary patch | ||||
literal 5 | ||||
Mc\${NkU|\`?^000jF3jhEB | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Matt Mackall
|
r3736 | hg manifest --debug | grep mbinary | ||
Alexis S. L. Carvalho
|
r4679 | |||
echo % filenames with spaces | ||||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -m spaces - <<EOF | ||
Alexis S. L. Carvalho
|
r4679 | diff --git a/foo bar b/foo bar | ||
new file mode 100644 | ||||
index 0000000..257cc56 | ||||
--- /dev/null | ||||
+++ b/foo bar | ||||
@@ -0,0 +1 @@ | ||||
+foo | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Alexis S. L. Carvalho
|
r4679 | cat "foo bar" | ||
Alexis S. L. Carvalho
|
r5403 | echo % copy then modify the original file | ||
Benoit Boissinot
|
r10928 | hg import -d "1000000 0" -m copy-mod-orig - <<EOF | ||
Alexis S. L. Carvalho
|
r5403 | diff --git a/foo2 b/foo2 | ||
index 257cc56..fe08ec6 100644 | ||||
--- a/foo2 | ||||
+++ b/foo2 | ||||
@@ -1 +1,2 @@ | ||||
foo | ||||
+new line | ||||
diff --git a/foo2 b/foo3 | ||||
similarity index 100% | ||||
copy from foo2 | ||||
copy to foo3 | ||||
EOF | ||||
Benoit Boissinot
|
r10928 | hg tip -q | ||
Alexis S. L. Carvalho
|
r5403 | |||
cat foo3 | ||||