Patchwork [3,of,4] tests: merge 'test-push-validation.t' into 'test-push.t'

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 3, 2016, 8:35 a.m.
Message ID <d5f07aeefda46b3cd179.1478162120@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/17315/
State Accepted
Headers show

Comments

Pierre-Yves David - Nov. 3, 2016, 8:35 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1478146214 -3600
#      Thu Nov 03 05:10:14 2016 +0100
# Node ID d5f07aeefda46b3cd17962565940516f69ed1f56
# Parent  2df91e4f382100ec1f5c835bfe2c23081b415ce0
# EXP-Topic pushtest
tests: merge 'test-push-validation.t' into 'test-push.t'

That test file is very small and is merge with the new 'test-push.t'. No logic
is changed but repository name are update to avoid collision.

We don't register this as a copy because is actually a "ypoc" merging two file
together without replacing the destination and Mercurial cannot express that.
timeless - Nov. 4, 2016, 7:15 p.m.
Pierre-Yves David wrote:
> tests: merge 'test-push-validation.t' into 'test-push.t'
>
> That test file is very small and is merge with the new 'test-push.t'. No logic
> is changed but repository name are update to avoid collision.
>
> We don't register this as a copy because is actually a "ypoc" merging two file
> together without replacing the destination and Mercurial cannot express that.

Actually, it can:

0: a b
0->1: rename a->d
0->2: rename b->d
1+2->3: merge d

This should give you the history you want in `hg ann`.
Pierre-Yves David - Nov. 7, 2016, 12:41 p.m.
On 11/04/2016 08:15 PM, timeless wrote:
> Pierre-Yves David wrote:
>> tests: merge 'test-push-validation.t' into 'test-push.t'
>>
>> That test file is very small and is merge with the new 'test-push.t'. No logic
>> is changed but repository name are update to avoid collision.
>>
>> We don't register this as a copy because is actually a "ypoc" merging two file
>> together without replacing the destination and Mercurial cannot express that.
>
> Actually, it can:
>
> 0: a b
> 0->1: rename a->d
> 0->2: rename b->d
> 1+2->3: merge d
>
> This should give you the history you want in `hg ann`.

Hu, good point, but the UI only offer it through merge. We could offer 
make copy able to record them but I'm not sure its a good idea.

Cheers,

Patch

diff --git a/tests/test-push-validation.t b/tests/test-push-validation.t
deleted file mode 100644
--- a/tests/test-push-validation.t
+++ /dev/null
@@ -1,92 +0,0 @@ 
-  $ hg init test
-  $ cd test
-
-  $ cat > .hg/hgrc <<EOF
-  > [server]
-  > validate=1
-  > EOF
-
-  $ echo alpha > alpha
-  $ echo beta > beta
-  $ hg addr
-  adding alpha
-  adding beta
-  $ hg ci -m 1
-
-  $ cd ..
-  $ hg clone test test-clone
-  updating to branch default
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-
-Test spurious filelog entries:
-
-  $ cd test-clone
-  $ echo blah >> beta
-  $ cp .hg/store/data/beta.i tmp1
-  $ hg ci -m 2
-  $ cp .hg/store/data/beta.i tmp2
-  $ hg -q rollback
-  $ mv tmp2 .hg/store/data/beta.i
-  $ echo blah >> beta
-  $ hg ci -m '2 (corrupt)'
-
-Expected to fail:
-
-  $ hg verify
-  checking changesets
-  checking manifests
-  crosschecking files in changesets and manifests
-  checking files
-   beta@1: dddc47b3ba30 not in manifests
-  2 files, 2 changesets, 4 total revisions
-  1 integrity errors encountered!
-  (first damaged changeset appears to be 1)
-  [1]
-
-  $ hg push
-  pushing to $TESTTMP/test (glob)
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  transaction abort!
-  rollback completed
-  abort: received spurious file revlog entry
-  [255]
-
-  $ hg -q rollback
-  $ mv tmp1 .hg/store/data/beta.i
-  $ echo beta > beta
-
-Test missing filelog entries:
-
-  $ cp .hg/store/data/beta.i tmp
-  $ echo blah >> beta
-  $ hg ci -m '2 (corrupt)'
-  $ mv tmp .hg/store/data/beta.i
-
-Expected to fail:
-
-  $ hg verify
-  checking changesets
-  checking manifests
-  crosschecking files in changesets and manifests
-  checking files
-   beta@1: manifest refers to unknown revision dddc47b3ba30
-  2 files, 2 changesets, 2 total revisions
-  1 integrity errors encountered!
-  (first damaged changeset appears to be 1)
-  [1]
-
-  $ hg push
-  pushing to $TESTTMP/test (glob)
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  transaction abort!
-  rollback completed
-  abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify
-  [255]
-
-  $ cd ..
diff --git a/tests/test-push.t b/tests/test-push.t
--- a/tests/test-push.t
+++ b/tests/test-push.t
@@ -147,3 +147,99 @@  Testing of the '--rev' flag
   4 files, 9 changesets, 7 total revisions
 
   $ cd ..
+
+Test server side validation during push
+=======================================
+
+  $ hg init test-validation
+  $ cd test-validation
+
+  $ cat > .hg/hgrc <<EOF
+  > [server]
+  > validate=1
+  > EOF
+
+  $ echo alpha > alpha
+  $ echo beta > beta
+  $ hg addr
+  adding alpha
+  adding beta
+  $ hg ci -m 1
+
+  $ cd ..
+  $ hg clone test-validation test-validation-clone
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Test spurious filelog entries:
+
+  $ cd test-validation-clone
+  $ echo blah >> beta
+  $ cp .hg/store/data/beta.i tmp1
+  $ hg ci -m 2
+  $ cp .hg/store/data/beta.i tmp2
+  $ hg -q rollback
+  $ mv tmp2 .hg/store/data/beta.i
+  $ echo blah >> beta
+  $ hg ci -m '2 (corrupt)'
+
+Expected to fail:
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+   beta@1: dddc47b3ba30 not in manifests
+  2 files, 2 changesets, 4 total revisions
+  1 integrity errors encountered!
+  (first damaged changeset appears to be 1)
+  [1]
+
+  $ hg push
+  pushing to $TESTTMP/test-validation (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  transaction abort!
+  rollback completed
+  abort: received spurious file revlog entry
+  [255]
+
+  $ hg -q rollback
+  $ mv tmp1 .hg/store/data/beta.i
+  $ echo beta > beta
+
+Test missing filelog entries:
+
+  $ cp .hg/store/data/beta.i tmp
+  $ echo blah >> beta
+  $ hg ci -m '2 (corrupt)'
+  $ mv tmp .hg/store/data/beta.i
+
+Expected to fail:
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+   beta@1: manifest refers to unknown revision dddc47b3ba30
+  2 files, 2 changesets, 2 total revisions
+  1 integrity errors encountered!
+  (first damaged changeset appears to be 1)
+  [1]
+
+  $ hg push
+  pushing to $TESTTMP/test-validation (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  transaction abort!
+  rollback completed
+  abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify
+  [255]
+
+  $ cd ..