##// END OF EJS Templates
narrow: rework logic to check whether we need to widen and narrow...
Pulkit Goyal -
r40462:30a7d3b6 default
parent child Browse files
Show More
@@ -392,9 +392,21 b' def trackedcmd(ui, repo, remotepath=None'
392 removedincludes = narrowspec.parsepatterns(opts['removeinclude'])
392 removedincludes = narrowspec.parsepatterns(opts['removeinclude'])
393 addedexcludes = narrowspec.parsepatterns(opts['addexclude'])
393 addedexcludes = narrowspec.parsepatterns(opts['addexclude'])
394 removedexcludes = narrowspec.parsepatterns(opts['removeexclude'])
394 removedexcludes = narrowspec.parsepatterns(opts['removeexclude'])
395
396 only_show = not (addedincludes or removedincludes or addedexcludes or
397 removedexcludes or newrules)
398
399 oldincludes, oldexcludes = repo.narrowpats
400
401 # filter the user passed additions and deletions into actual additions and
402 # deletions of excludes and includes
403 addedincludes = set([i for i in addedincludes if i not in oldincludes])
404 removedincludes = set([i for i in removedincludes if i in oldincludes])
405 addedexcludes = set([i for i in addedexcludes if i not in oldexcludes])
406 removedexcludes = set([i for i in removedexcludes if i in oldexcludes])
407
395 widening = addedincludes or removedexcludes
408 widening = addedincludes or removedexcludes
396 narrowing = removedincludes or addedexcludes
409 narrowing = removedincludes or addedexcludes
397 only_show = not widening and not narrowing
398
410
399 # Only print the current narrowspec.
411 # Only print the current narrowspec.
400 if only_show:
412 if only_show:
@@ -413,6 +425,10 b' def trackedcmd(ui, repo, remotepath=None'
413 fm.end()
425 fm.end()
414 return 0
426 return 0
415
427
428 if not widening and not narrowing:
429 ui.status(_("nothing to widen or narrow\n"))
430 return 0
431
416 with repo.wlock(), repo.lock():
432 with repo.wlock(), repo.lock():
417 cmdutil.bailifchanged(repo)
433 cmdutil.bailifchanged(repo)
418
434
@@ -432,7 +448,6 b' def trackedcmd(ui, repo, remotepath=None'
432
448
433 commoninc = discovery.findcommonincoming(repo, remote)
449 commoninc = discovery.findcommonincoming(repo, remote)
434
450
435 oldincludes, oldexcludes = repo.narrowpats
436 if narrowing:
451 if narrowing:
437 newincludes = oldincludes - removedincludes
452 newincludes = oldincludes - removedincludes
438 newexcludes = oldexcludes | addedexcludes
453 newexcludes = oldexcludes | addedexcludes
@@ -58,7 +58,11 b' gracefully:'
58 comparing with http://localhost:$HGPORT1/
58 comparing with http://localhost:$HGPORT1/
59 searching for changes
59 searching for changes
60 looking for local changes to affected paths
60 looking for local changes to affected paths
61
61 $ hg tracked --addinclude f1 http://localhost:$HGPORT1/
62 $ hg tracked --addinclude f1 http://localhost:$HGPORT1/
63 nothing to widen or narrow
64
65 $ hg tracked --addinclude f9 http://localhost:$HGPORT1/
62 comparing with http://localhost:$HGPORT1/
66 comparing with http://localhost:$HGPORT1/
63 abort: server does not support narrow clones
67 abort: server does not support narrow clones
64 [255]
68 [255]
@@ -144,12 +144,7 b' Test that extending already included fil'
144 wireprotocol command
144 wireprotocol command
145
145
146 $ hg tracked --addinclude widest/f
146 $ hg tracked --addinclude widest/f
147 comparing with ssh://user@dummy/master
147 nothing to widen or narrow
148 searching for changes
149 adding changesets
150 adding manifests
151 adding file changes
152 added 0 changesets with 0 changes to 0 files
153
148
154 Pull down the newly added upstream revision.
149 Pull down the newly added upstream revision.
155
150
General Comments 0
You need to be logged in to leave comments. Login now