Patchwork merge : deprecate the --force option

login
register
mail settings
Submitter Florence Laguzet
Date July 17, 2013, 10:01 p.m.
Message ID <9b722d1121d852f52c45.1374098491@shiva.lan>
Download mbox | patch
Permalink /patch/1929/
State Superseded
Commit 9bfa86746c9c1f6ab51deb8f174ffc482417d09f
Headers show

Comments

Florence Laguzet - July 17, 2013, 10:01 p.m.
# HG changeset patch
# User Florence Laguzet <florence.laguzet@gmail.com>
# Date 1374098284 -7200
# Node ID 9b722d1121d852f52c453e55619a2bcefb815cb3
# Parent  3185b347ae9829ea275973f65460539fa01f36f6
merge : deprecate the --force option

The --force option in merge does not make what people think it does so it may
not be visible to everyone.

I have local changes and want to pull one's changes which made 2 heads.
The --force option in help says
 " -f --force  force a merge with outstanding changes"
so I can expect that I can use it to force the merge and commit it in
my local repository without taking my local changes into account.
But merging with -f keeps local changes and "add" them : they must be committed
or reverted before doing the merge commit.
The merge -f cannot be  reverted so it leads my repository in a bad state :
cannot commit  merge and don't want to revert/commit local changes yet.

Message in help have been updated to emphasize the fact that local changes are
included in the merge.
Pierre-Yves David - July 18, 2013, 5:21 a.m.
On 18 juil. 2013, at 00:01, Florence Laguzet wrote:

> # HG changeset patch
> # User Florence Laguzet <florence.laguzet@gmail.com>
> # Date 1374098284 -7200
> # Node ID 9b722d1121d852f52c453e55619a2bcefb815cb3
> # Parent  3185b347ae9829ea275973f65460539fa01f36f6
> merge : deprecate the --force option
> 
> The --force option in merge does not make what people think it does so it may
> not be visible to everyone.
> 
> I have local changes and want to pull one's changes which made 2 heads.
> The --force option in help says
> " -f --force  force a merge with outstanding changes"
> so I can expect that I can use it to force the merge and commit it in
> my local repository without taking my local changes into account.
> But merging with -f keeps local changes and "add" them : they must be committed
> or reverted before doing the merge commit.
> The merge -f cannot be  reverted so it leads my repository in a bad state :
> cannot commit  merge and don't want to revert/commit local changes yet.

+1 I can't see a sensible use case for that flag and I've seen multiples people coming from svn tricked into using this flag. They get in pretty nasty situation as they usually does not know how to abort the merge at all (using hg update --clean) and are forced to either abandon their repository or commit unwanted changes.

Patch

diff -r 3185b347ae98 -r 9b722d1121d8 mercurial/commands.py
--- a/mercurial/commands.py	Tue Jul 16 11:53:53 2013 -0500
+++ b/mercurial/commands.py	Wed Jul 17 23:58:04 2013 +0200
@@ -4157,7 +4157,8 @@ 
     fm.end()
 
 @command('^merge',
-    [('f', 'force', None, _('force a merge with outstanding changes')),
+    [('f', 'force', None,
+      _('force a merge including outstanding changes (DEPRECATED)')),
     ('r', 'rev', '', _('revision to merge'), _('REV')),
     ('P', 'preview', None,
      _('review revisions to merge (no merge is performed)'))