comparison mercurial/cmdutil.py @ 23326:f6b8d23492e5

remove: support remove with explicit paths in subrepos
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 12 Nov 2014 23:15:20 -0500
parents 4165cfd67519
children bd296bb4b5c8
comparison
equal deleted inserted replaced
23325:4165cfd67519 23326:f6b8d23492e5
2058 s = repo.status(match=m, clean=True) 2058 s = repo.status(match=m, clean=True)
2059 modified, added, deleted, clean = s[0], s[1], s[3], s[6] 2059 modified, added, deleted, clean = s[0], s[1], s[3], s[6]
2060 2060
2061 wctx = repo[None] 2061 wctx = repo[None]
2062 2062
2063 if subrepos: 2063 for subpath in sorted(wctx.substate):
2064 for subpath in sorted(wctx.substate): 2064 def matchessubrepo(matcher, subpath):
2065 if matcher.exact(subpath):
2066 return True
2067 for f in matcher.files():
2068 if f.startswith(subpath):
2069 return True
2070 return False
2071
2072 if subrepos or matchessubrepo(m, subpath):
2065 sub = wctx.sub(subpath) 2073 sub = wctx.sub(subpath)
2066 try: 2074 try:
2067 submatch = matchmod.narrowmatcher(subpath, m) 2075 submatch = matchmod.narrowmatcher(subpath, m)
2068 if sub.removefiles(ui, submatch, prefix, after, force, 2076 if sub.removefiles(ui, submatch, prefix, after, force,
2069 subrepos): 2077 subrepos):
2078 for subpath in wctx.substate: 2086 for subpath in wctx.substate:
2079 if f.startswith(subpath): 2087 if f.startswith(subpath):
2080 return True 2088 return True
2081 return False 2089 return False
2082 2090
2083 if f in repo.dirstate or f in wctx.dirs() or (subrepos and insubrepo()): 2091 if f in repo.dirstate or f in wctx.dirs() or insubrepo():
2084 continue 2092 continue
2085 2093
2086 if os.path.exists(m.rel(join(f))): 2094 if os.path.exists(m.rel(join(f))):
2087 if os.path.isdir(m.rel(join(f))): 2095 if os.path.isdir(m.rel(join(f))):
2088 ui.warn(_('not removing %s: no tracked files\n') 2096 ui.warn(_('not removing %s: no tracked files\n')