mvn release:prepare fails when there is a different branch in hg outgoing 
changes
---------------------------------------------------------------------------------

                 Key: SCM-583
                 URL: http://jira.codehaus.org/browse/SCM-583
             Project: Maven SCM
          Issue Type: Bug
          Components: maven-scm-provider-mercurial (hg)
    Affects Versions: 1.4
         Environment: all
            Reporter: Laurent Perez


Hello

Using release:prepare, the hg provider assumes it is free to use the basic 
'push' command as in 'hg push repoUrl'.

However, if you have created and commited a local feature branch, the release 
will fail, because the default behaviour of Mercurial is to abort the push if 
it would create new remote branches, as illustrated :

{code}
MacBook-Pro-de-laurent:hgsample laurent$ hg out
comparaison avec http://macbook-pro-de-laurent.local:8000
searching for changes
changeset:   57:33b0705da6e8
branch:      local-dev ### the local feature branch you are working on
user:        laurent
date:        Fri Nov 12 21:10:37 2010 +0100
summary:     add local-dev

changeset:   91:ca4aabf8d3b3
tag:         tip ### the working branch you want to release
user:        laurent
date:        Sat Nov 13 00:49:49 2010 +0100
summary:     ajout hgrelease

MacBook-Pro-de-laurent:hgsample laurent$ hg push
pushing to http://macbook-pro-de-laurent.local:8000
searching for changes
abort: push creates new remote branches: local-dev!
(use 'hg push --new-branch' to create new remote branches)
{code}

Since the hg provider does not check for possible local branches, all pushes 
(checkin and tag) will fail with exit code 1 when the hg push command is 
triggered :

{code}
MacBook-Pro-de-laurent:hgsample laurent$ mvn release:prepare
...
[INFO] EXECUTING: /bin/sh -c cd /Users/laurent/Desktop/work/rrepo/hgsample && 
hg push http://127.0.0.1:8000
[ERROR] 
EXECUTION FAILED
  Execution of cmd : push failed with exit code: 1.
  Working directory was: 
    /Users/laurent/Desktop/work/rrepo/hgsample
  Your Hg installation seems to be valid and complete.
    Hg version: 1.6.4+20101001 (OK)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
{code}

The expected Mercurial fix for this case is to use push --force or --new-branch 
to push the feature branch (which is not always the preferred solution) to the 
repository, or to use push -rbranchname to only push working branch changesets.

The attached patch uses the second solution. It introduces a HgOutgoingConsumer 
and a HgChangeSet to parse the output of 'hg out', looks for a possible local 
feature branch, warns (like Mercurial) if one is found, but does not abort the 
release, instead, it will find the current working branch name, and use the 
push to use the -rbranchname option.

I believe this is a legitimate fix, since Mercurial, like all DCVS, promotes 
local feature branches usage, and it was a bit sad to see the mvn release fail 
on the releasable branch because of this :)
 



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to