Source

editcommitmsgs / tests / test-editcommitmsgs.t

Full commit
Setting up configuration without mq
  $ echo "[extensions]" >> $HGRCPATH
  $ echo "editcommitmsgs=$TESTDIR/../editcommitmsgs.py" >> $HGRCPATH
  $ hg help editcommitmsgs
  editcommitmsgs: could not find mq extensions
  editcommitmsgs extension - 
  
  This extension do only have an effect if Mercurial Queues (mq) is enables.
  Then it will allow you to edit commit messages of all patches in a single
  file.
  
  no commands defined

Setting up configuration with mq

  $ echo "[extensions]" >> $HGRCPATH
  $ echo "mq=" >> $HGRCPATH
  $ echo "editcommitmsgs=$TESTDIR/../editcommitmsgs.py" >> $HGRCPATH
  $ hg help editcommitmsgs
  editcommitmsgs extension - 
  
  This extension do only have an effect if Mercurial Queues (mq) is enables.
  Then it will allow you to edit commit messages of all patches in a single
  file.
  
  list of commands:
  
   qeditcommitmsgs   Edit commit message of all applied patches
  
  use "hg -v help editcommitmsgs" to show aliases and global options

Creating a repository with some patches

  $ hg init
  $ touch f1
  $ hg add f1
  $ hg qnew p1
  $ touch f2
  $ hg add f2
  $ hg qnew p2
  $ touch f3
  $ hg add f3
  $ hg qnew p3
  $ echo c3 > f3
  $ hg status
  M f3

Trying to edit commit message in unclean repository

  $ hg qeditcommitmsgs
  abort: local changes found, refresh first
  $ hg qrefresh

Trying to edit commit messages with no patches applied
  $ hg qpop -a
  popping p3
  popping p2
  popping p1
  patch queue now empty
  $ hg qeditcommitmsgs
  No patches applied
  $ hg qpush -a
  applying p1
  applying p2
  applying p3
  now at: p3

Trying to edit commit message, but doesn't do any changes
  $ cat > editor << '__EOF__'
  > #!/bin/sh
  > echo "HG: Enter commit messages for the different patches."  >> $1
  > echo "HG: Lines beginning with 'HG:' is used to apply the" >> $1
  > echo "HG: messages to the right patch, and gives some status on the patch" >> $1
  > echo "HG: Which can help you write the commit messages, so please do not" >> $1
  > echo "HG: edit them" >> $1
  > echo "HG: --" >> $1
  > echo "HG: Applied patches:" >> $1
  > echo "HG: --" >> $1
  > echo "HG: Patch: p1" >> $1
  > echo "HG: --" >> $1
  > echo "HG: Patch: p2" >> $1
  > echo "HG: --"  >> $1
  > echo "HG: Patch: p3" >> $1
  > echo "HG: --" >? $1
  > echo >> $1
  > __EOF__
  $ chmod 777 `pwd`/editor
  $ EDITOR="'`pwd`'"/editor
  $ hg qeditcommitmsgs

Trying to edit commit message, add some changes
  $ cat > editor2 << '__EOF__'
  > #!/bin/sh
  > echo "HG: Enter commit messages for the different patches."  >> $1
  > echo "HG: Lines beginning with 'HG:' is used to apply the" >> $1
  > echo "HG: messages to the right patch, and gives some status on the patch" >> $1
  > echo "HG: Which can help you write the commit messages, so please do not" >> $1
  > echo "HG: edit them" >> $1
  > echo "HG: --" >> $1
  > echo "HG: Applied patches:" >> $1
  > echo "HG: --" >> $1
  > echo "HG: Patch: p1" >> $1
  > echo "This is the first patch" >> $1
  > echo "HG: --" >> $1
  > echo "HG: Patch: p2" >> $1
  > echo "This is the second patch" >> $1
  > echo "This is second line of second patch" >> $1
  > echo "HG: --"  >> $1
  > echo "HG: Patch: p3" >> $1
  > echo "This is the third patch" >> $1
  > echo "HG: --" >> $1
  > echo >> $1
  > __EOF__
  $ chmod 777 `pwd`/editor2
  $ HGEDITOR="'`pwd`'"/editor2 
  $ hg qeditcommitmsgs
  $ hg log -l1 --template "{desc}\n"
  This is the third patch
  $ hg log -l1 --template "{desc}\n" -r -2
  This is the second patch
  This is second line of second patch
  $ hg log -l1 --template "{desc}\n" -r -3
  This is the first patch

Trying to edit commit message, now shows status info
  $ hg qnew p4
  $ hg qeditcommitmsgs --showstatus