rewing: prevent rewind in case of uncommitted changes
rewind can update, which means merge and troubles. We might relax this
limitation in the future.
--- a/hgext3rd/evolve/rewind.py Sun Jun 17 03:46:46 2018 +0200
+++ b/hgext3rd/evolve/rewind.py Sun Jun 17 03:56:54 2018 +0200
@@ -4,6 +4,7 @@
import hashlib
from mercurial import (
+ cmdutil,
error,
hg,
obsolete,
@@ -77,6 +78,8 @@
rewindmap = {}
sscache = {}
with repo.wlock(), repo.lock():
+ # stay on the safe side: prevent local case in case we need to upgrade
+ cmdutil.bailifchanged(repo)
rewinded = _select_rewinded(repo, opts)
--- a/tests/test-rewind.t Sun Jun 17 03:46:46 2018 +0200
+++ b/tests/test-rewind.t Sun Jun 17 03:56:54 2018 +0200
@@ -917,3 +917,21 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: c_ROOT
+ $ cd ..
+
+Check error cases
+=================
+
+ $ hg clone rewind-testing-base rewind-testing-error
+ updating to branch default
+ 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ cd rewind-testing-error
+
+Uncommited changes
+------------------
+
+ $ echo C > C
+ $ hg add C
+ $ hg rewind
+ abort: uncommitted changes
+ [255]