Patchwork D5510: narrow: reuse narrowspec.updateworkingcopy() when widening

login
register
mail settings
Submitter phabricator
Date Jan. 7, 2019, 9:19 a.m.
Message ID <a66a9a6ddfaefd93cd69ec5ad09ea0de@localhost.localdomain>
Download mbox | patch
Permalink /patch/37514/
State Not Applicable
Headers show

Comments

phabricator - Jan. 7, 2019, 9:19 a.m.
martinvonz updated this revision to Diff 13038.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5510?vs=13032&id=13038

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

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

CHANGE DETAILS




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

Patch

diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -128,7 +128,7 @@ 
   added 0 changesets with 1 changes to 1 files
   bundle2-input-part: total payload size * (glob)
   bundle2-input-bundle: 0 parts total
-   widest/f: add from widened narrow clone -> g
+   widest/f: narrowspec updated -> g
   getting widest/f
   $ hg tracked
   I path:inside
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -316,20 +316,10 @@ 
                 bundle2.processbundle(repo, bundle,
                         transactiongetter=tgetter)
 
-        repo.setnewnarrowpats()
-        narrowspec.copytoworkingcopy(repo)
-        actions = merge.emptyactions()
-        addgaction = actions['g'].append
-
-        mf = repo['.'].manifest().matches(newmatch)
-        for f, fn in mf.iteritems():
-            if f not in repo.dirstate:
-                addgaction((f, (mf.flags(f), False),
-                            "add from widened narrow clone"))
-
-        merge.applyupdates(repo, actions, wctx=repo[None],
-                           mctx=repo['.'], overwrite=False)
-        merge.recordupdates(repo, actions, branchmerge=False)
+        with repo.transaction('widening') as tr:
+            repo.setnewnarrowpats()
+            narrowspec.updateworkingcopy(repo, tr)
+            narrowspec.copytoworkingcopy(repo)
 
 # TODO(rdamazio): Make new matcher format and update description
 @command('tracked',