hgext/narrow/narrowcommands.py
changeset 46477 3c360ab2688d
parent 46117 6cc269bd1c29
child 46663 a4c19a162615
--- a/hgext/narrow/narrowcommands.py	Fri Jan 29 15:23:07 2021 +0100
+++ b/hgext/narrow/narrowcommands.py	Wed Feb 03 13:55:58 2021 -0800
@@ -214,6 +214,7 @@
     newincludes,
     newexcludes,
     force,
+    backup,
 ):
     oldmatch = narrowspec.match(repo.root, oldincludes, oldexcludes)
     newmatch = narrowspec.match(repo.root, newincludes, newexcludes)
@@ -272,7 +273,7 @@
                 hg.clean(repo, urev)
             overrides = {(b'devel', b'strip-obsmarkers'): False}
             with ui.configoverride(overrides, b'narrow'):
-                repair.strip(ui, unfi, tostrip, topic=b'narrow')
+                repair.strip(ui, unfi, tostrip, topic=b'narrow', backup=backup)
 
         todelete = []
         for f, f2, size in repo.store.datafiles():
@@ -442,6 +443,12 @@
         ),
         (
             b'',
+            b'backup',
+            True,
+            _(b'back up local changes when narrowing'),
+        ),
+        (
+            b'',
             b'update-working-copy',
             False,
             _(b'update working copy when the store has changed'),
@@ -639,6 +646,7 @@
                 newincludes,
                 newexcludes,
                 opts[b'force_delete_local_changes'],
+                opts[b'backup'],
             )
             # _narrow() updated the narrowspec and _widen() below needs to
             # use the updated values as its base (otherwise removed includes