577 fm.write(b'status', b'%s ', b'X', label=b'narrow.excluded') |
577 fm.write(b'status', b'%s ', b'X', label=b'narrow.excluded') |
578 fm.write(b'pat', b'%s\n', i, label=b'narrow.excluded') |
578 fm.write(b'pat', b'%s\n', i, label=b'narrow.excluded') |
579 fm.end() |
579 fm.end() |
580 return 0 |
580 return 0 |
581 |
581 |
582 oldincludes, oldexcludes = repo.narrowpats |
|
583 |
|
584 # filter the user passed additions and deletions into actual additions and |
|
585 # deletions of excludes and includes |
|
586 addedincludes -= oldincludes |
|
587 removedincludes &= oldincludes |
|
588 addedexcludes -= oldexcludes |
|
589 removedexcludes &= oldexcludes |
|
590 |
|
591 widening = addedincludes or removedexcludes |
|
592 narrowing = removedincludes or addedexcludes |
|
593 |
|
594 if update_working_copy: |
|
595 with repo.wlock(), repo.lock(), repo.transaction( |
|
596 b'narrow-wc' |
|
597 ), repo.dirstate.changing_parents(repo): |
|
598 narrowspec.updateworkingcopy(repo) |
|
599 narrowspec.copytoworkingcopy(repo) |
|
600 return 0 |
|
601 |
|
602 if not (widening or narrowing or autoremoveincludes): |
|
603 ui.status(_(b"nothing to widen or narrow\n")) |
|
604 return 0 |
|
605 |
|
606 with repo.wlock(), repo.lock(): |
582 with repo.wlock(), repo.lock(): |
|
583 oldincludes, oldexcludes = repo.narrowpats |
|
584 |
|
585 # filter the user passed additions and deletions into actual additions and |
|
586 # deletions of excludes and includes |
|
587 addedincludes -= oldincludes |
|
588 removedincludes &= oldincludes |
|
589 addedexcludes -= oldexcludes |
|
590 removedexcludes &= oldexcludes |
|
591 |
|
592 widening = addedincludes or removedexcludes |
|
593 narrowing = removedincludes or addedexcludes |
|
594 |
|
595 if update_working_copy: |
|
596 with repo.transaction(b'narrow-wc'), repo.dirstate.changing_parents( |
|
597 repo |
|
598 ): |
|
599 narrowspec.updateworkingcopy(repo) |
|
600 narrowspec.copytoworkingcopy(repo) |
|
601 return 0 |
|
602 |
|
603 if not (widening or narrowing or autoremoveincludes): |
|
604 ui.status(_(b"nothing to widen or narrow\n")) |
|
605 return 0 |
|
606 |
607 cmdutil.bailifchanged(repo) |
607 cmdutil.bailifchanged(repo) |
608 |
608 |
609 # Find the revisions we have in common with the remote. These will |
609 # Find the revisions we have in common with the remote. These will |
610 # be used for finding local-only changes for narrowing. They will |
610 # be used for finding local-only changes for narrowing. They will |
611 # also define the set of revisions to update for widening. |
611 # also define the set of revisions to update for widening. |