# HG changeset patch
# User Mads Kiilerich <mad...@unity3d.com>
# Date 1478208837 -3600
#      Thu Nov 03 22:33:57 2016 +0100
# Node ID f6408efe0d0f4179fe6cc2b967164c1b4567f3d6
# Parent  d06c049695e6ad3219e7479c65ce98a2f123e878
tests: explore some bdiff cases

diff --git a/tests/test-bhalf.t b/tests/test-bhalf.t
new file mode 100644
--- /dev/null
+++ b/tests/test-bhalf.t
@@ -0,0 +1,140 @@
+A couple of test cases exploring the bdiff implementation.
+
+Diff of boring files:
+
+  $ hg init repo1
+  $ cd repo1
+  $ (for i in `seq 15`; do echo "once upon a time $i"; echo "The quick brown 
fox jumps over the lazy dog"; done; echo) > this-is-the-filename
+  $ hg add this-is-the-filename
+  $ hg ci -m "commit message commit message commit message commit message 
commit message commit message commit message commit message"
+  $ (for i in `seq 15`; do echo "twice upon a time $i"; echo "The quick brown 
fox jumps over the lazy dog"; done; echo) > this-is-the-filename
+  $ hg diff --git
+  diff --git a/this-is-the-filename b/this-is-the-filename
+  --- a/this-is-the-filename
+  +++ b/this-is-the-filename
+  @@ -1,31 +1,31 @@
+  -once upon a time 1
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 2
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 3
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 4
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 5
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 6
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 7
+  +twice upon a time 1
+   The quick brown fox jumps over the lazy dog
+  -once upon a time 8
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 9
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 10
+  +twice upon a time 2
+   The quick brown fox jumps over the lazy dog
+  -once upon a time 11
+  -The quick brown fox jumps over the lazy dog
+  -once upon a time 12
+  +twice upon a time 3
+   The quick brown fox jumps over the lazy dog
+  -once upon a time 13
+  +twice upon a time 4
+   The quick brown fox jumps over the lazy dog
+  -once upon a time 14
+  +twice upon a time 5
+   The quick brown fox jumps over the lazy dog
+  -once upon a time 15
+  +twice upon a time 6
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 7
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 8
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 9
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 10
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 11
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 12
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 13
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 14
+  +The quick brown fox jumps over the lazy dog
+  +twice upon a time 15
+   The quick brown fox jumps over the lazy dog
+   
+That's an odd diff for a trivial change!
+
+  $ hg ci -m "commit message commit message commit message commit message 
commit message commit message commit message commit message"
+  $ hg bundle --base null ../bundle.hg
+  2 changesets found
+  $ cd ..
+
+  $ f --size bundle.hg
+  bundle.hg: size=878
+
+Explore some bdiff implementation edge cases:
+
+  $ hg init repo2
+  $ cd repo2
+  $ cat << EOF >> x
+  > a
+  > EOF
+  $ cat << EOF >> y
+  > a
+  > a
+  > a
+  > EOF
+  $ cat << EOF >> z
+  > a
+  > a
+  > a
+  > a
+  > a
+  > EOF
+  $ hg ci -qAm0
+  $ cat << EOF > x
+  > a
+  > a
+  > a
+  > EOF
+  $ cat << EOF > y
+  > a
+  > EOF
+  $ cat << EOF > z
+  > a
+  > EOF
+  $ hg diff --git
+  diff --git a/x b/x
+  --- a/x
+  +++ b/x
+  @@ -1,1 +1,3 @@
+   a
+  +a
+  +a
+  diff --git a/y b/y
+  --- a/y
+  +++ b/y
+  @@ -1,3 +1,1 @@
+   a
+  -a
+  -a
+  diff --git a/z b/z
+  --- a/z
+  +++ b/z
+  @@ -1,5 +1,1 @@
+  -a
+   a
+  -a
+  -a
+  -a
+
+x and y shows the preference for adding / removing at the end of sequences ...
+z just seems weird.
+
+  $ cd ..
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to