1153 m = match(repo, pats, opts) |
1153 m = match(repo, pats, opts) |
1154 if pats: |
1154 if pats: |
1155 modified, added, removed = repo.status(match=m)[:3] |
1155 modified, added, removed = repo.status(match=m)[:3] |
1156 files = util.sort(modified + added + removed) |
1156 files = util.sort(modified + added + removed) |
1157 slist = None |
1157 slist = None |
|
1158 |
|
1159 def is_dir(f): |
|
1160 name = f + '/' |
|
1161 i = bisect.bisect(files, name) |
|
1162 return i < len(files) and files[i].startswith(name) |
|
1163 |
1158 for f in m.files(): |
1164 for f in m.files(): |
1159 if f == '.': |
1165 if f == '.': |
1160 continue |
1166 continue |
1161 if f not in files: |
1167 if f not in files: |
1162 rf = repo.wjoin(f) |
1168 rf = repo.wjoin(f) |
1163 rel = repo.pathto(f) |
1169 rel = repo.pathto(f) |
1164 try: |
1170 try: |
1165 mode = os.lstat(rf)[stat.ST_MODE] |
1171 mode = os.lstat(rf)[stat.ST_MODE] |
1166 except OSError: |
1172 except OSError: |
|
1173 if is_dir(f): # deleted directory ? |
|
1174 continue |
1167 raise util.Abort(_("file %s not found!") % rel) |
1175 raise util.Abort(_("file %s not found!") % rel) |
1168 if stat.S_ISDIR(mode): |
1176 if stat.S_ISDIR(mode): |
1169 name = f + '/' |
1177 if not is_dir(f): |
1170 i = bisect.bisect(files, name) |
|
1171 if i >= len(files) or not files[i].startswith(name): |
|
1172 raise util.Abort(_("no match under directory %s!") |
1178 raise util.Abort(_("no match under directory %s!") |
1173 % rel) |
1179 % rel) |
1174 elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)): |
1180 elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)): |
1175 raise util.Abort(_("can't commit %s: " |
1181 raise util.Abort(_("can't commit %s: " |
1176 "unsupported file type!") % rel) |
1182 "unsupported file type!") % rel) |