##// END OF EJS Templates
purge: use opts.get()...
Gregory Szorc -
r29222:ed4bd789 default
parent child Browse files
Show More
@@ -84,13 +84,13 b' def purge(ui, repo, *dirs, **opts):'
84 list of files that this program would delete, use the --print
84 list of files that this program would delete, use the --print
85 option.
85 option.
86 '''
86 '''
87 act = not opts['print']
87 act = not opts.get('print')
88 eol = '\n'
88 eol = '\n'
89 if opts['print0']:
89 if opts.get('print0'):
90 eol = '\0'
90 eol = '\0'
91 act = False # --print0 implies --print
91 act = False # --print0 implies --print
92 removefiles = opts['files']
92 removefiles = opts.get('files')
93 removedirs = opts['dirs']
93 removedirs = opts.get('dirs')
94 if not removefiles and not removedirs:
94 if not removefiles and not removedirs:
95 removefiles = True
95 removefiles = True
96 removedirs = True
96 removedirs = True
@@ -101,7 +101,7 b' def purge(ui, repo, *dirs, **opts):'
101 remove_func(repo.wjoin(name))
101 remove_func(repo.wjoin(name))
102 except OSError:
102 except OSError:
103 m = _('%s cannot be removed') % name
103 m = _('%s cannot be removed') % name
104 if opts['abort_on_err']:
104 if opts.get('abort_on_err'):
105 raise error.Abort(m)
105 raise error.Abort(m)
106 ui.warn(_('warning: %s\n') % m)
106 ui.warn(_('warning: %s\n') % m)
107 else:
107 else:
@@ -111,7 +111,7 b' def purge(ui, repo, *dirs, **opts):'
111 if removedirs:
111 if removedirs:
112 directories = []
112 directories = []
113 match.explicitdir = match.traversedir = directories.append
113 match.explicitdir = match.traversedir = directories.append
114 status = repo.status(match=match, ignored=opts['all'], unknown=True)
114 status = repo.status(match=match, ignored=opts.get('all'), unknown=True)
115
115
116 if removefiles:
116 if removefiles:
117 for f in sorted(status.unknown + status.ignored):
117 for f in sorted(status.unknown + status.ignored):
General Comments 0
You need to be logged in to leave comments. Login now