Patchwork rebase: fail-fast pull if working dir is not clean

login
register
mail settings
Submitter Valters Vingolds
Date Jan. 2, 2017, 9:18 a.m.
Message ID <390134fdec5612ec59f3.1483348683@w540>
Download mbox | patch
Permalink /patch/18062/
State Changes Requested
Headers show

Comments

Valters Vingolds - Jan. 2, 2017, 9:18 a.m.
# HG changeset patch
# User Valters Vingolds <valters@vingolds.ch>
# Date 1483272989 -3600
#      Sun Jan 01 13:16:29 2017 +0100
# Branch stable
# Node ID 390134fdec5612ec59f33c02ca45e969839b3a1b
# Parent  7817df5585db1d87d3f6c7f496085c86d87e2e9a
rebase: fail-fast pull if working dir is not clean

Refuse to run 'hg pull --rebase' if there are uncommitted changes:
so that instead of going ahead with fetching changes and then suddenly aborting
the rebase, we can warn user of uncommitted changes (or unclean repo state)
right up front.
timeless - Jan. 3, 2017, 3:27 a.m.
Thanks for this. I've been  meaning to do it...
Pierre-Yves David - Jan. 4, 2017, 3:53 p.m.
On 01/02/2017 10:18 AM, Valters Vingolds wrote:
> # HG changeset patch
> # User Valters Vingolds <valters@vingolds.ch>
> # Date 1483272989 -3600
> #      Sun Jan 01 13:16:29 2017 +0100
> # Branch stable
> # Node ID 390134fdec5612ec59f33c02ca45e969839b3a1b
> # Parent  7817df5585db1d87d3f6c7f496085c86d87e2e9a
> rebase: fail-fast pull if working dir is not clean
>
> Refuse to run 'hg pull --rebase' if there are uncommitted changes:
> so that instead of going ahead with fetching changes and then suddenly aborting
> the rebase, we can warn user of uncommitted changes (or unclean repo state)
> right up front.

If I get that change right, this means that if the working copy is dirty 
(or operation are in progress) we no longer perform the "pull" phase of 
the "pull+rebase" operation.

I think this make sense but this a behavior change so it needs a "(BC)" 
flag at the end of the description summary. In addition, we will want 
this tested. Can you update one of the rebase testcase to check this 
case? (see "tests/test-rebase*.t")

Thanks,

> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -1306,6 +1306,10 @@
>                  ui.debug('--update and --rebase are not compatible, ignoring '
>                           'the update flag\n')
>
> +            ui.debug('before rebase: ensure working dir is clean\n')
> +            cmdutil.checkunfinished(repo)
> +            cmdutil.bailifchanged(repo)
> +
>              revsprepull = len(repo)
>              origpostincoming = commands.postincoming
>              def _dummy(*args, **kwargs):
Valters Vingolds - Jan. 4, 2017, 4:06 p.m.
Hi, sure - I will look into this.

On Wed, Jan 4, 2017 at 4:53 PM, Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

>
>
> On 01/02/2017 10:18 AM, Valters Vingolds wrote:
>
>> # HG changeset patch
>> # User Valters Vingolds <valters@vingolds.ch>
>> # Date 1483272989 -3600
>> #      Sun Jan 01 13:16:29 2017 +0100
>> # Branch stable
>> # Node ID 390134fdec5612ec59f33c02ca45e969839b3a1b
>> # Parent  7817df5585db1d87d3f6c7f496085c86d87e2e9a
>> rebase: fail-fast pull if working dir is not clean
>>
>> Refuse to run 'hg pull --rebase' if there are uncommitted changes:
>> so that instead of going ahead with fetching changes and then suddenly
>> aborting
>> the rebase, we can warn user of uncommitted changes (or unclean repo
>> state)
>> right up front.
>>
>
> If I get that change right, this means that if the working copy is dirty
> (or operation are in progress) we no longer perform the "pull" phase of the
> "pull+rebase" operation.
>
> I think this make sense but this a behavior change so it needs a "(BC)"
> flag at the end of the description summary. In addition, we will want this
> tested. Can you update one of the rebase testcase to check this case? (see
> "tests/test-rebase*.t")
>
> Thanks,
>
>

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1306,6 +1306,10 @@ 
                 ui.debug('--update and --rebase are not compatible, ignoring '
                          'the update flag\n')
 
+            ui.debug('before rebase: ensure working dir is clean\n')
+            cmdutil.checkunfinished(repo)
+            cmdutil.bailifchanged(repo)
+
             revsprepull = len(repo)
             origpostincoming = commands.postincoming
             def _dummy(*args, **kwargs):