Patchwork [V2] check-commit: add an automatic testing of all draft changesets under "."

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 6, 2014, 10:23 p.m.
Message ID <5595ac2ca511b66bc172.1407363833@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5301/
State Changes Requested
Headers show

Comments

Pierre-Yves David - Aug. 6, 2014, 10:23 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1407314451 25200
#      Wed Aug 06 01:40:51 2014 -0700
# Node ID 5595ac2ca511b66bc17279f3e4fb04d845a08a46
# Parent  1274ff3f20a803fbf665182fa40182cfd2deeb41
check-commit: add an automatic testing of all draft changesets under "."

We introduce a test-check-commit-hg.t file that will happily run the
check-commit file on all draft changeset under the working directory.

This should help newcomers to catch up with the rules. (And will helps old timer
from time to time).
Augie Fackler - Aug. 7, 2014, 1:52 p.m.
On Wed, Aug 06, 2014 at 03:23:53PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1407314451 25200
> #      Wed Aug 06 01:40:51 2014 -0700
> # Node ID 5595ac2ca511b66bc17279f3e4fb04d845a08a46
> # Parent  1274ff3f20a803fbf665182fa40182cfd2deeb41
> check-commit: add an automatic testing of all draft changesets under "."

Maybe clearer as:

test-check-commit-hg.t: automatically test all 'draft() and ::.' changesets

I'm +0 on the idea.

>
> We introduce a test-check-commit-hg.t file that will happily run the
> check-commit file on all draft changeset under the working directory.
>
> This should help newcomers to catch up with the rules. (And will helps old timer
> from time to time).
>
> diff --git a/tests/test-check-commit-hg.t b/tests/test-check-commit-hg.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-check-commit-hg.t
> @@ -0,0 +1,26 @@
> +#require test-repo
> +
> +Enable obsolescence to avoid the warning issue when obsmarker are found
> +
> +  $ cat > obs.py << EOF
> +  > import mercurial.obsolete
> +  > mercurial.obsolete._enabled = True
> +  > EOF
> +  $ echo '[extensions]' >> $HGRCPATH
> +  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
> +
> +Go back in the hg repo
> +
> +  $ cd $TESTDIR/..
> +
> +  $ for node in $(hg log --rev 'draft() and ::.' --template '{node|short}\n'); do
> +  >    hg export $node | contrib/check-commit > ${TESTTMP}/check-commit.out
> +  >    if [ $? -ne 0 ]; then
> +  >        echo "Revision $node does not comply to commit message rules"
> +  >        echo '------------------------------------------------------'
> +  >        cat ${TESTTMP}/check-commit.out
> +  >        echo
> +  >   fi
> +  > done
> +
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Aug. 7, 2014, 5:45 p.m.
On 08/07/2014 06:52 AM, Augie Fackler wrote:
> On Wed, Aug 06, 2014 at 03:23:53PM -0700, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1407314451 25200
>> #      Wed Aug 06 01:40:51 2014 -0700
>> # Node ID 5595ac2ca511b66bc17279f3e4fb04d845a08a46
>> # Parent  1274ff3f20a803fbf665182fa40182cfd2deeb41
>> check-commit: add an automatic testing of all draft changesets under "."
>
> Maybe clearer as:
>
> test-check-commit-hg.t: automatically test all 'draft() and ::.' changesets
>
> I'm +0 on the idea.

I updated the line and pushed the result to the clowncopter

(queued)

Patch

diff --git a/tests/test-check-commit-hg.t b/tests/test-check-commit-hg.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-commit-hg.t
@@ -0,0 +1,26 @@ 
+#require test-repo
+
+Enable obsolescence to avoid the warning issue when obsmarker are found
+
+  $ cat > obs.py << EOF
+  > import mercurial.obsolete
+  > mercurial.obsolete._enabled = True
+  > EOF
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
+
+Go back in the hg repo
+
+  $ cd $TESTDIR/..
+
+  $ for node in $(hg log --rev 'draft() and ::.' --template '{node|short}\n'); do
+  >    hg export $node | contrib/check-commit > ${TESTTMP}/check-commit.out
+  >    if [ $? -ne 0 ]; then
+  >        echo "Revision $node does not comply to commit message rules"
+  >        echo '------------------------------------------------------'
+  >        cat ${TESTTMP}/check-commit.out
+  >        echo
+  >   fi
+  > done
+
+