# HG changeset patch # User Pierre-Yves David # Date 1677120569 -3600 # Node ID c74d4ce646fba61f78f54905bb01c7936be06c73 # Parent e9d92faa08f89e7bb42a86061532d2099bcfe83c narrow: move `only_show` handling sooner in `tracked` This will help us to improve the locking scope in the `tracked` command. diff -r e9d92faa08f8 -r c74d4ce646fb hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py Fri Feb 24 13:23:15 2023 +0000 +++ b/hgext/narrow/narrowcommands.py Thu Feb 23 03:49:29 2023 +0100 @@ -563,20 +563,9 @@ or update_working_copy ) - oldincludes, oldexcludes = repo.narrowpats - - # filter the user passed additions and deletions into actual additions and - # deletions of excludes and includes - addedincludes -= oldincludes - removedincludes &= oldincludes - addedexcludes -= oldexcludes - removedexcludes &= oldexcludes - - widening = addedincludes or removedexcludes - narrowing = removedincludes or addedexcludes - # Only print the current narrowspec. if only_show: + oldincludes, oldexcludes = repo.narrowpats ui.pager(b'tracked') fm = ui.formatter(b'narrow', opts) for i in sorted(oldincludes): @@ -590,6 +579,18 @@ fm.end() return 0 + oldincludes, oldexcludes = repo.narrowpats + + # filter the user passed additions and deletions into actual additions and + # deletions of excludes and includes + addedincludes -= oldincludes + removedincludes &= oldincludes + addedexcludes -= oldexcludes + removedexcludes &= oldexcludes + + widening = addedincludes or removedexcludes + narrowing = removedincludes or addedexcludes + if update_working_copy: with repo.wlock(), repo.lock(), repo.transaction( b'narrow-wc'