equal
deleted
inserted
replaced
2696 |
2696 |
2697 |
2697 |
2698 def purge( |
2698 def purge( |
2699 repo, |
2699 repo, |
2700 matcher, |
2700 matcher, |
|
2701 unknown=True, |
2701 ignored=False, |
2702 ignored=False, |
2702 removeemptydirs=True, |
2703 removeemptydirs=True, |
2703 removefiles=True, |
2704 removefiles=True, |
2704 abortonerror=False, |
2705 abortonerror=False, |
2705 noop=False, |
2706 noop=False, |
2707 """Purge the working directory of untracked files. |
2708 """Purge the working directory of untracked files. |
2708 |
2709 |
2709 ``matcher`` is a matcher configured to scan the working directory - |
2710 ``matcher`` is a matcher configured to scan the working directory - |
2710 potentially a subset. |
2711 potentially a subset. |
2711 |
2712 |
2712 ``ignored`` controls whether ignored files should also be purged. |
2713 ``unknown`` controls whether unknown files should be purged. |
|
2714 |
|
2715 ``ignored`` controls whether ignored files should be purged. |
2713 |
2716 |
2714 ``removeemptydirs`` controls whether empty directories should be removed. |
2717 ``removeemptydirs`` controls whether empty directories should be removed. |
2715 |
2718 |
2716 ``removefiles`` controls whether files are removed. |
2719 ``removefiles`` controls whether files are removed. |
2717 |
2720 |
2744 try: |
2747 try: |
2745 if removeemptydirs: |
2748 if removeemptydirs: |
2746 directories = [] |
2749 directories = [] |
2747 matcher.traversedir = directories.append |
2750 matcher.traversedir = directories.append |
2748 |
2751 |
2749 status = repo.status(match=matcher, ignored=ignored, unknown=True) |
2752 status = repo.status(match=matcher, ignored=ignored, unknown=unknown) |
2750 |
2753 |
2751 if removefiles: |
2754 if removefiles: |
2752 for f in sorted(status.unknown + status.ignored): |
2755 for f in sorted(status.unknown + status.ignored): |
2753 if not noop: |
2756 if not noop: |
2754 repo.ui.note(_(b'removing file %s\n') % f) |
2757 repo.ui.note(_(b'removing file %s\n') % f) |