summaryrefslogtreecommitdiff
path: root/tests/test-import-git.t
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-import-git.t')
-rw-r--r--tests/test-import-git.t189
1 files changed, 23 insertions, 166 deletions
diff --git a/tests/test-import-git.t b/tests/test-import-git.t
index caba23b..ca5462a 100644
--- a/tests/test-import-git.t
+++ b/tests/test-import-git.t
@@ -1,5 +1,5 @@
- $ hg init repo
- $ cd repo
+
+ $ hg init
New file:
@@ -40,19 +40,14 @@ chmod +x:
> EOF
applying patch from stdin
-#if execbit
$ hg tip -q
2:3a34410f282e
+
$ test -x new
- $ hg rollback -q
-#else
- $ hg tip -q
- 1:ab199dc869b5
-#endif
-Copy and removing x bit:
+Copy:
- $ hg import -f -d "1000000 0" -mcopy - <<EOF
+ $ hg import -d "1000000 0" -mcopy - <<EOF
> diff --git a/new b/copy
> old mode 100755
> new mode 100644
@@ -66,37 +61,15 @@ Copy and removing x bit:
> EOF
applying patch from stdin
- $ test -f copy
-#if execbit
- $ test ! -x copy
- $ test -x copyx
- $ hg tip -q
- 2:21dfaae65c71
-#else
$ hg tip -q
- 2:0efdaa8e3bf3
-#endif
-
- $ hg up -qCr1
- $ hg rollback -q
+ 3:37bacb7ca14d
-Copy (like above but independent of execbit):
-
- $ hg import -d "1000000 0" -mcopy - <<EOF
- > diff --git a/new b/copy
- > 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
- applying patch from stdin
-
- $ hg tip -q
- 2:0efdaa8e3bf3
- $ test -f copy
+ $ if "$TESTDIR/hghave" -q execbit; then
+ > test -f copy -a ! -x copy || echo bad
+ > test -x copyx || echo bad
+ > else
+ > test -f copy || echo bad
+ > fi
$ cat copy
a
@@ -115,7 +88,7 @@ Rename:
applying patch from stdin
$ hg tip -q
- 3:b1f57753fad2
+ 4:47b81a94361d
$ hg locate
copyx
@@ -137,7 +110,7 @@ Delete:
applying patch from stdin
$ hg tip -q
- 4:1bd1da94b9b2
+ 5:d9b001d98336
$ hg locate
empty
@@ -164,7 +137,7 @@ Regular diff:
applying patch from stdin
$ hg tip -q
- 5:46fe99cb3035
+ 6:ebe901e7576b
Copy and modify:
@@ -187,7 +160,7 @@ Copy and modify:
applying patch from stdin
$ hg tip -q
- 6:ffeb3197c12d
+ 7:18f368958ecd
$ hg cat copy2
a
@@ -217,7 +190,7 @@ Rename and modify:
applying patch from stdin
$ hg tip -q
- 7:401aede9e6bb
+ 8:c32b0d7e6f44
$ hg locate copy2
[1]
@@ -241,10 +214,10 @@ One file renamed multiple times:
applying patch from stdin
$ hg tip -q
- 8:2ef727e684e8
+ 9:034a6bf95330
$ hg log -vr. --template '{rev} {files} / {file_copies}\n'
- 8 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2)
+ 9 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2)
$ hg locate rename2 rename3 rename3-2
rename3
@@ -285,7 +258,7 @@ Binary files and regular patch hunks:
applying patch from stdin
$ hg tip -q
- 10:27377172366e
+ 11:c39bce63e786
$ cat foo2
foo
@@ -314,7 +287,7 @@ Multiple binary files:
applying patch from stdin
$ hg tip -q
- 11:18b73a84b4ab
+ 12:30b530085242
$ hg manifest --debug | grep mbinary
045c85ba38952325e126c70962cc0f9d9077bc67 644 mbinary1
@@ -334,7 +307,7 @@ Filenames with spaces:
applying patch from stdin
$ hg tip -q
- 12:47500ce1614e
+ 13:04750ef42fb3
$ cat "foo bar"
foo
@@ -357,7 +330,7 @@ Copy then modify the original file:
applying patch from stdin
$ hg tip -q
- 13:6757efb07ea9
+ 14:c4cd9cdeaa74
$ cat foo3
foo
@@ -388,77 +361,6 @@ Move text file and patch as binary
A binary2
text2
R text2
-
-Invalid base85 content
-
- $ hg rollback
- repository tip rolled back to revision 14 (undo import)
- working directory now based on revision 14
- $ hg revert -aq
- $ hg import -d "1000000 0" -m invalid-binary - <<"EOF"
- > diff --git a/text2 b/binary2
- > rename from text2
- > rename to binary2
- > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
- > GIT binary patch
- > literal 5
- > Mc$`b*O.$Pw00T?_*Z=?k
- >
- > EOF
- applying patch from stdin
- abort: could not decode "binary2" binary patch: bad base85 character at position 6
- [255]
-
- $ hg revert -aq
- $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
- > diff --git a/text2 b/binary2
- > rename from text2
- > rename to binary2
- > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
- > GIT binary patch
- > literal 6
- > Mc$`b*O5$Pw00T?_*Z=?k
- >
- > EOF
- applying patch from stdin
- abort: "binary2" length is 5 bytes, should be 6
- [255]
-
- $ hg revert -aq
- $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
- > diff --git a/text2 b/binary2
- > rename from text2
- > rename to binary2
- > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
- > GIT binary patch
- > Mc$`b*O5$Pw00T?_*Z=?k
- >
- > EOF
- applying patch from stdin
- abort: could not extract "binary2" binary data
- [255]
-
-Simulate a copy/paste turning LF into CRLF (issue2870)
-
- $ hg revert -aq
- $ cat > binary.diff <<"EOF"
- > diff --git a/text2 b/binary2
- > rename from text2
- > rename to binary2
- > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
- > GIT binary patch
- > literal 5
- > Mc$`b*O5$Pw00T?_*Z=?k
- >
- > EOF
- >>> fp = file('binary.diff', 'rb')
- >>> data = fp.read()
- >>> fp.close()
- >>> file('binary.diff', 'wb').write(data.replace('\n', '\r\n'))
- $ rm binary2
- $ hg import --no-commit binary.diff
- applying binary.diff
-
$ cd ..
Consecutive import with renames (issue2459)
@@ -499,23 +401,6 @@ Renames and strip
A b
a
R a
-
-Renames, similarity and git diff
-
- $ hg revert -aC
- undeleting a
- forgetting b
- $ rm b
- $ hg import --similarity 90 --no-commit - <<EOF
- > diff --git a/a b/b
- > rename from a
- > rename to b
- > EOF
- applying patch from stdin
- $ hg st --copies
- A b
- a
- R a
$ cd ..
Pure copy with existing destination
@@ -558,8 +443,6 @@ Copy and changes with existing destination
$ cat b
b
-#if symlink
-
$ ln -s b linkb
$ hg add linkb
$ hg ci -m addlinkb
@@ -582,30 +465,4 @@ Copy and changes with existing destination
? b.rej
? linkb.rej
-#endif
-
-Test corner case involving copies and multiple hunks (issue3384)
-
- $ hg revert -qa
- $ hg import --no-commit - <<EOF
- > diff --git a/a b/c
- > copy from a
- > copy to c
- > --- a/a
- > +++ b/c
- > @@ -1,1 +1,2 @@
- > a
- > +a
- > @@ -2,1 +2,2 @@
- > a
- > +a
- > diff --git a/a b/a
- > --- a/a
- > +++ b/a
- > @@ -1,1 +1,2 @@
- > a
- > +b
- > EOF
- applying patch from stdin
-
$ cd ..