Re: [PATCH 1 of 3 V4] rebase: fail-fast the pull if working dir is not clean (BC)

2017-01-06 Thread Pierre-Yves David



On 01/06/2017 04:11 PM, Valters Vingolds wrote:

# HG changeset patch
# User Valters Vingolds 
# Date 1483272989 -3600
#  Sun Jan 01 13:16:29 2017 +0100
# Node ID ba648b03fc21c8213d580c8ed193002511e3f872
# Parent  011122b3b1c42374fb0489d107418e1be3665ca6
rebase: fail-fast the pull if working dir is not clean (BC)


We still have a discussion in progress on V3, so I'm surprised to see a 
V4. Let us slow down a bit here.


I was about to reply to your last message about V3. What's the change 
and motivation in V4 ?




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.

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1316,6 +1316,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):
diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
--- a/tests/test-rebase-pull.t
+++ b/tests/test-rebase-pull.t
@@ -72,6 +72,19 @@
   searching for changes
   no changes found

+Abort pull early if working dir is not clean:
+
+  $ echo L1-mod > L1
+  $ hg pull --rebase
+  abort: uncommitted changes
+  [255]
+  $ hg update --clean --quiet
+  $ touch .hg/rebasestate # make rebase think there's one in progress right now
+  $ hg pull --rebase
+  abort: rebase in progress
+  (use 'hg rebase --continue' or 'hg rebase --abort')
+  [255]
+  $ rm .hg/rebasestate

 Invoke pull --rebase and nothing to rebase:

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



--
Pierre-Yves David
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3 V4] rebase: fail-fast the pull if working dir is not clean (BC)

2017-01-06 Thread Valters Vingolds
# HG changeset patch
# User Valters Vingolds 
# Date 1483272989 -3600
#  Sun Jan 01 13:16:29 2017 +0100
# Node ID ba648b03fc21c8213d580c8ed193002511e3f872
# Parent  011122b3b1c42374fb0489d107418e1be3665ca6
rebase: fail-fast the pull if working dir is not clean (BC)

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.

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1316,6 +1316,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):
diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
--- a/tests/test-rebase-pull.t
+++ b/tests/test-rebase-pull.t
@@ -72,6 +72,19 @@
   searching for changes
   no changes found
 
+Abort pull early if working dir is not clean:
+
+  $ echo L1-mod > L1
+  $ hg pull --rebase
+  abort: uncommitted changes
+  [255]
+  $ hg update --clean --quiet
+  $ touch .hg/rebasestate # make rebase think there's one in progress right now
+  $ hg pull --rebase
+  abort: rebase in progress
+  (use 'hg rebase --continue' or 'hg rebase --abort')
+  [255]
+  $ rm .hg/rebasestate
 
 Invoke pull --rebase and nothing to rebase:
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel