changeset 39357:2b8adb7ca39a

narrow: update the narrowspecs to new ones after pulling when widening The ellipsis case updates the new narrowspecs at bundle2 handling code, and non-ellipsis widening didn't use to work and never set the new narrowpats. Previous pacth added server side logic for widening without ellipsis. This patch adds the missing repo.setnarrowpats() so that we set the new narrowpats after widening in non-ellipsis cases also. This makes widening with non-ellipsis case work but there are certain things which we can improve. Differential Revision: https://phab.mercurial-scm.org/D4384
author Pulkit Goyal <pulkit@yandex-team.ru>
date Mon, 27 Aug 2018 14:02:48 +0300
parents c8e4eae84808
children 57b2a02420cd
files hgext/narrow/narrowcommands.py tests/test-narrow-widen-non-ellipsis.t
diffstat 2 files changed, 25 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowcommands.py	Sun Aug 26 20:20:34 2018 +0300
+++ b/hgext/narrow/narrowcommands.py	Mon Aug 27 14:02:48 2018 +0300
@@ -307,6 +307,7 @@
         with ds.parentchange():
             ds.setparents(p1, p2)
 
+        repo.setnewnarrowpats()
         actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()}
         addgaction = actions['g'].append
 
--- a/tests/test-narrow-widen-non-ellipsis.t	Sun Aug 26 20:20:34 2018 +0300
+++ b/tests/test-narrow-widen-non-ellipsis.t	Mon Aug 27 14:02:48 2018 +0300
@@ -96,6 +96,7 @@
   3 local changesets published
   $ hg tracked
   I path:inside
+  I path:wider/f
 
 Pull down the newly added upstream revision.
 
@@ -105,20 +106,18 @@
   adding changesets
   adding manifests
   adding file changes
-  added 5 changesets with 1 changes to 1 files
+  added 5 changesets with 2 changes to 2 files
   new changesets *:* (glob)
   (run 'hg update' to get a working copy)
   $ hg update -r 'desc("add wider")'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat wider/f
-  cat: wider/f: $ENOENT$
-  [1]
+  wider
 
   $ hg update -r 'desc("update inside")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat wider/f
-  cat: wider/f: $ENOENT$
-  [1]
+  wider
   $ cat inside/f
   inside v2
 
@@ -148,35 +147,30 @@
   adding changesets
   adding manifests
   adding file changes
-  added 0 changesets with 4 changes to 2 files
+  added 0 changesets with 4 changes to 3 files
   5 local changesets published
-  abort: path ends in directory separator: widest/
-  [255]
   $ hg tracked
   I path:inside
+  I path:wider/f
+  I path:widest
   $ hg update 'desc("add widest")'
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ cat widest/f
+  widest
+  $ hg update 'desc("add wider, update widest")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat wider/f
+  wider
+  $ cat widest/f
+  widest v2
+  $ hg update 'desc("update widest v3")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
-  $ hg update 'desc("add wider, update widest")'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat wider/f
-  cat: wider/f: $ENOENT$
-  [1]
+  widest v3
+  $ hg update 'desc("update widest v4")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
-  $ hg update 'desc("update widest v3")'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
-  $ hg update 'desc("update widest v4")'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
+  widest v4
 
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
   *: update widest v4 (glob)
@@ -260,10 +254,9 @@
   adding file changes
   added 0 changesets with 1 changes to 5 files
   11 local changesets published
-  abort: path ends in directory separator: d1/
-  [255]
   $ hg tracked
   I path:d0
+  I path:d1
   I path:d3
   I path:d6
   I path:d9
@@ -286,12 +279,9 @@
   checking changesets
   checking manifests
   checking directory manifests
-  warning: orphan data file 'meta/d1/00manifest.i'
   crosschecking files in changesets and manifests
   checking files
-  warning: orphan data file 'data/d1/f.i'
-  4 files, 11 changesets, 4 total revisions
-  2 warnings encountered!
+  5 files, 11 changesets, 5 total revisions
 
 Widening preserves parent of local commit
 
@@ -309,8 +299,6 @@
   $ hg ci -m local
   created new head
   $ hg tracked -q --addinclude d0 --addinclude d9
-  abort: path ends in directory separator: d0/
-  [255]
 
 Widening preserves bookmarks
 
@@ -323,8 +311,6 @@
   $ hg bookmarks
    * bookmark                  11:42aed9c63197
   $ hg -q tracked --addinclude d2
-  abort: path ends in directory separator: d2/
-  [255]
   $ hg bookmarks
    * bookmark                  11:42aed9c63197
   $ hg log -r bookmark -T '{desc}\n'
@@ -360,8 +346,6 @@
   adding file changes
   added 0 changesets with 1 changes to 2 files
   11 local changesets published
-  abort: path ends in directory separator: d1/
-  [255]
   $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
   11: local
   10: add d10/f