##// END OF EJS Templates
purge: use status
Matt Mackall -
r6754:0b700faa default
parent child Browse files
Show More
@@ -56,7 +56,6 b' def purge(ui, repo, *dirs, **opts):'
56 files that this program would delete use the --print option.
56 files that this program would delete use the --print option.
57 '''
57 '''
58 act = not opts['print']
58 act = not opts['print']
59 ignored = bool(opts['all'])
60 abort_on_err = bool(opts['abort_on_err'])
59 abort_on_err = bool(opts['abort_on_err'])
61 eol = opts['print0'] and '\0' or '\n'
60 eol = opts['print0'] and '\0' or '\n'
62 if eol == '\0':
61 if eol == '\0':
@@ -86,16 +85,14 b' def purge(ui, repo, *dirs, **opts):'
86 files = []
85 files = []
87 match = cmdutil.match(repo, dirs, opts)
86 match = cmdutil.match(repo, dirs, opts)
88 match.dir = directories.append
87 match.dir = directories.append
89 for src, f, st in repo.dirstate.statwalk(match, ignored=ignored):
88 status = repo.status(match=match, ignored=opts['all'], unknown=True)
90 if src == 'f' and f not in repo.dirstate:
89 files = status[4] + status[5]
91 files.append(f)
90 files.sort()
92
93 directories.sort()
91 directories.sort()
94
92
95 for f in files:
93 for f in files:
96 if f not in repo.dirstate:
94 ui.note(_('Removing file %s\n') % f)
97 ui.note(_('Removing file %s\n') % f)
95 remove(os.remove, f)
98 remove(os.remove, f)
99
96
100 for f in directories[::-1]:
97 for f in directories[::-1]:
101 if match(f) and not os.listdir(repo.wjoin(f)):
98 if match(f) and not os.listdir(repo.wjoin(f)):
General Comments 0
You need to be logged in to leave comments. Login now