[
https://issues.apache.org/jira/browse/SCM-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17962097#comment-17962097
]
ASF GitHub Bot commented on SCM-583:
------------------------------------
jira-importer opened a new issue, #782:
URL: https://github.com/apache/maven-scm/issues/782
**[Laurent
Perez](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=laurent7979)**
opened
**[SCM-583](https://issues.apache.org/jira/browse/SCM-583?redirect=false)** and
commented
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 :
```
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)
```
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 :
```
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]
------------------------------------------------------------------------
```
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 :)
---
**Affects:** 1.4
**Attachments:**
-
[SCM-583-maven-scm-provider-hg.patch](https://issues.apache.org/jira/secure/attachment/12718897/SCM-583-maven-scm-provider-hg.patch)
(_15.27 kB_)
-
[SCM-583-maven-scm-provider-hg-reopen.patch](https://issues.apache.org/jira/secure/attachment/12718806/SCM-583-maven-scm-provider-hg-reopen.patch)
(_1.11 kB_)
**Issue Links:**
- [SCM-682](https://issues.apache.org/jira/browse/SCM-682) Maven release
fails when releasing from a named branch
> mvn release:prepare fails when there is a different branch in hg outgoing
> changes
> ---------------------------------------------------------------------------------
>
> Key: SCM-583
> URL: https://issues.apache.org/jira/browse/SCM-583
> Project: Maven SCM (Moved to GitHub Issues)
> Issue Type: Bug
> Components: maven-scm-provider-mercurial (hg)
> Affects Versions: 1.4
> Environment: all
> Reporter: Laurent Perez
> Assignee: Olivier Lamy
> Priority: Major
> Fix For: 1.5
>
> Attachments: SCM-583-maven-scm-provider-hg-reopen.patch,
> SCM-583-maven-scm-provider-hg.patch
>
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)