tests/test-releasenotes-merging.t
author Yuya Nishihara <yuya@tcha.org>
Mon, 07 Aug 2017 22:22:28 +0900
branchstable
changeset 33660 3fee7f7d2da0
parent 33012 5814db57941c
child 33698 3748098d072a
permissions -rw-r--r--
ssh: unban the use of pipe character in user@host:port string This vulnerability was fixed by the previous patch and there were more ways to exploit than using '|shellcmd'. So it doesn't make sense to reject only pipe character. Test cases are updated to actually try to exploit the bug. As the SSH bridge of git/svn subrepos are not managed by our code, the tests for non-hg subrepos are just removed. This may be folded into the original patches.

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > releasenotes=
  > EOF

  $ hg init simple-repo
  $ cd simple-repo

A fix directive from commit message is added to release notes

  $ touch fix1
  $ hg -q commit -A -l - << EOF
  > commit 1
  > 
  > .. fix::
  > 
  >    Fix from commit message.
  > EOF

  $ cat >> $TESTTMP/single-fix-bullet << EOF
  > Bug Fixes
  > =========
  > 
  > * Fix from release notes.
  > EOF

  $ hg releasenotes -r . $TESTTMP/single-fix-bullet

  $ cat $TESTTMP/single-fix-bullet
  Bug Fixes
  =========
  
  * Fix from release notes.
  
  * Fix from commit message.

Processing again ignores the already added bullet.

  $ hg releasenotes -r . $TESTTMP/single-fix-bullet

  $ cat $TESTTMP/single-fix-bullet
  Bug Fixes
  =========
  
  * Fix from release notes.
  
  * Fix from commit message.

  $ cd ..

Sections are unioned

  $ hg init subsections
  $ cd subsections
  $ touch fix1
  $ hg -q commit -A -l - << EOF
  > Commit 1
  > 
  > .. feature:: Commit Message Feature
  > 
  >    This describes a feature from a commit message.
  > EOF

  $ cat >> $TESTTMP/single-feature-section << EOF
  > New Features
  > ============
  > 
  > Notes Feature
  > -------------
  > 
  > This describes a feature from a release notes file.
  > EOF

  $ hg releasenotes -r . $TESTTMP/single-feature-section

  $ cat $TESTTMP/single-feature-section
  New Features
  ============
  
  Notes Feature
  -------------
  
  This describes a feature from a release notes file.
  
  Commit Message Feature
  ----------------------
  
  This describes a feature from a commit message.

Doing it again won't add another section

  $ hg releasenotes -r . $TESTTMP/single-feature-section
  Commit Message Feature already exists in feature section; ignoring

  $ cat $TESTTMP/single-feature-section
  New Features
  ============
  
  Notes Feature
  -------------
  
  This describes a feature from a release notes file.
  
  Commit Message Feature
  ----------------------
  
  This describes a feature from a commit message.

  $ cd ..

Bullets from rev merge with those from notes file.

  $ hg init bullets
  $ cd bullets
  $ touch fix1
  $ hg -q commit -A -l - << EOF
  > commit 1
  > 
  > .. fix::
  > 
  >    this is fix1.
  > EOF

  $ touch fix2
  $ hg -q commit -A -l - << EOF
  > commit 2
  > 
  > .. fix::
  > 
  >    this is fix2.
  > EOF

  $ hg releasenotes -r 'all()' $TESTTMP/relnotes-bullet-problem
  $ cat $TESTTMP/relnotes-bullet-problem
  Bug Fixes
  =========
  
  * this is fix1.
  
  * this is fix2.
  $ touch fix3
  $ hg -q commit -A -l - << EOF
  > commit 3
  > 
  > .. fix::
  > 
  >    this is fix3.
  > EOF

  $ hg releasenotes -r . $TESTTMP/relnotes-bullet-problem
  $ cat $TESTTMP/relnotes-bullet-problem
  Bug Fixes
  =========
  
  * this is fix1.
  
  * this is fix2.
  
  * this is fix3.