From patchwork Wed Jan 4 16:48:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [V2] rebase: fail-fast the pull if working dir is not clean (BC) From: Valters Vingolds X-Patchwork-Id: 18092 Message-Id: <7aa236c41f585c2f3cf1.1483548516@w540> To: mercurial-devel@mercurial-scm.org Date: Wed, 04 Jan 2017 17:48:36 +0100 # HG changeset patch # User Valters Vingolds # Date 1483272989 -3600 # Sun Jan 01 13:16:29 2017 +0100 # Branch stable # Node ID 7aa236c41f585c2f3cf1e714708cb3232159367d # Parent 7817df5585db1d87d3f6c7f496085c86d87e2e9a 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 @@ -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): 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,13 @@ 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 Invoke pull --rebase and nothing to rebase: