patch: make 'hg pull --rebase' fail fast when uncommitted changes exist

Valters Vingolds valters at vingolds.ch
Mon Jan 2 08:40:39 UTC 2017


Hi, I got annoyed how often I miss some uncommitted changes and then when
trying to pull with --rebase, and then the rebase aborts. This change also
brings yjr behaviour in line with git behavior (of refusing to even begin
'pull --rebase' operation) when the working dir state is unclean.

# HG changeset patch
# User Valters Vingolds <valters at 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.

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
http://www.linkedin.com/in/valters
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial/attachments/20170102/37c6a86e/attachment.html>


More information about the Mercurial mailing list