30 from mercurial import util, commands, cmdutil |
30 from mercurial import util, commands, cmdutil |
31 from mercurial.i18n import _ |
31 from mercurial.i18n import _ |
32 import os |
32 import os |
33 |
33 |
34 def purge(ui, repo, *dirs, **opts): |
34 def purge(ui, repo, *dirs, **opts): |
35 '''removes files not tracked by mercurial |
35 '''removes files not tracked by Mercurial |
36 |
36 |
37 Delete files not known to mercurial, this is useful to test local and |
37 Delete files not known to Mercurial. This is useful to test local and |
38 uncommitted changes in the otherwise clean source tree. |
38 uncommitted changes in an otherwise-clean source tree. |
39 |
39 |
40 This means that purge will delete: |
40 This means that purge will delete: |
41 - Unknown files: files marked with "?" by "hg status" |
41 - Unknown files: files marked with "?" by "hg status" |
42 - Ignored files: files usually ignored by Mercurial because they match |
|
43 a pattern in a ".hgignore" file |
|
44 - Empty directories: in fact Mercurial ignores directories unless they |
42 - Empty directories: in fact Mercurial ignores directories unless they |
45 contain files under source control managment |
43 contain files under source control managment |
46 But it will leave untouched: |
44 But it will leave untouched: |
47 - Unmodified tracked files |
45 - Modified and unmodified tracked files |
48 - Modified tracked files |
46 - Ignored files (unless --all is specified) |
49 - New files added to the repository (with "hg add") |
47 - New files added to the repository (with "hg add") |
50 |
48 |
51 If directories are given on the command line, only files in these |
49 If directories are given on the command line, only files in these |
52 directories are considered. |
50 directories are considered. |
53 |
51 |
54 Be careful with purge, you could irreversibly delete some files you |
52 Be careful with purge, as you could irreversibly delete some files you |
55 forgot to add to the repository. If you only want to print the list of |
53 forgot to add to the repository. If you only want to print the list of |
56 files that this program would delete use the --print option. |
54 files that this program would delete, use the --print option. |
57 ''' |
55 ''' |
58 act = not opts['print'] |
56 act = not opts['print'] |
59 eol = '\n' |
57 eol = '\n' |
60 if opts['print0']: |
58 if opts['print0']: |
61 eol = '\0' |
59 eol = '\0' |