comparison mercurial/commands.py @ 17848:66f0c78350ab stable

remove: don't return error on directories with tracked files Spotted by Sergey <sergemp@mail.ru>
author Matt Mackall <mpm@selenic.com>
date Mon, 22 Oct 2012 16:06:47 -0500
parents b623e323c561
children 6da47b655d97
comparison
equal deleted inserted replaced
17847:1e4eb1faba6e 17848:66f0c78350ab
4840 4840
4841 m = scmutil.match(repo[None], pats, opts) 4841 m = scmutil.match(repo[None], pats, opts)
4842 s = repo.status(match=m, clean=True) 4842 s = repo.status(match=m, clean=True)
4843 modified, added, deleted, clean = s[0], s[1], s[3], s[6] 4843 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
4844 4844
4845 # warn about failure to delete explicit files/dirs
4846 wctx = repo[None]
4845 for f in m.files(): 4847 for f in m.files():
4846 if f not in repo.dirstate and not os.path.isdir(m.rel(f)): 4848 if f in repo.dirstate or f in wctx.dirs():
4847 if os.path.exists(m.rel(f)): 4849 continue
4850 if os.path.exists(m.rel(f)):
4851 if os.path.isdir(m.rel(f)):
4852 ui.warn(_('not removing %s: no tracked files\n') % m.rel(f))
4853 else:
4848 ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) 4854 ui.warn(_('not removing %s: file is untracked\n') % m.rel(f))
4849 ret = 1 4855 # missing files will generate a warning elsewhere
4856 ret = 1
4850 4857
4851 if force: 4858 if force:
4852 list = modified + deleted + clean + added 4859 list = modified + deleted + clean + added
4853 elif after: 4860 elif after:
4854 list = deleted 4861 list = deleted