D5364: narrow: don't resurrect old commits when narrowing (don't strip obsmarkers)

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Dec 5 06:57:28 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG77173267878b: narrow: don't resurrect old commits when narrowing (don't strip obsmarkers) (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5364?vs=12689&id=12706

REVISION DETAIL
  https://phab.mercurial-scm.org/D5364

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  tests/test-narrow.t

CHANGE DETAILS

diff --git a/tests/test-narrow.t b/tests/test-narrow.t
--- a/tests/test-narrow.t
+++ b/tests/test-narrow.t
@@ -214,6 +214,29 @@
   000000000000
   $ cd ..
 
+Narrowing doesn't resurrect old commits (unlike what regular `hg strip` does)
+  $ hg clone --narrow ssh://user@dummy/master narrow-obsmarkers --include d0 --include d3 -q
+  $ cd narrow-obsmarkers
+  $ echo a >> d0/f2
+  $ hg add d0/f2
+  $ hg ci -m 'modify d0/'
+  $ echo a >> d3/f2
+  $ hg add d3/f2
+  $ hg commit --amend -m 'modify d0/ and d3/'
+  $ hg log -T "{rev}: {desc}\n"
+  5: modify d0/ and d3/
+  3: add d10/f
+  2: add d3/f
+  1: add d2/f
+  0: add d0/f
+  $ hg tracked --removeinclude d3 --force-delete-local-changes -q
+  $ hg log -T "{rev}: {desc}\n"
+  3: add d10/f
+  2: add d3/f
+  1: add d2/f
+  0: add d0/f
+  $ cd ..
+
 Can remove last include, making repo empty
   $ hg clone --narrow ssh://user@dummy/master narrow-empty --include d0 -r 5
   adding changesets
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -215,7 +215,9 @@
                 urev = max(repo.revs('(::%n) - %ln + null',
                                      repo['.'].node(), visibletostrip))
                 hg.clean(repo, urev)
-            repair.strip(ui, unfi, tostrip, topic='narrow')
+            overrides = {('devel', 'strip-obsmarkers'): False}
+            with ui.configoverride(overrides, 'narrow'):
+                repair.strip(ui, unfi, tostrip, topic='narrow')
 
         todelete = []
         for f, f2, size in repo.store.datafiles():



To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list