806 if force: |
806 if force: |
807 changes[0].extend(changes[6]) # mq may commit unchanged files |
807 changes[0].extend(changes[6]) # mq may commit unchanged files |
808 |
808 |
809 # make sure all explicit patterns are matched |
809 # make sure all explicit patterns are matched |
810 if not force and match.files(): |
810 if not force and match.files(): |
811 files = sorted(changes[0] + changes[1] + changes[2]) |
811 matched = set(changes[0] + changes[1] + changes[2]) |
812 |
812 |
813 for f in match.files(): |
813 for f in match.files(): |
814 if f == '.' or f in files: # matched |
814 if f == '.' or f in matched: # matched |
815 continue |
815 continue |
816 if f in changes[3]: # missing |
816 if f in changes[3]: # missing |
817 fail(f, _('file not found!')) |
817 fail(f, _('file not found!')) |
818 if f in vdirs: # visited directory |
818 if f in vdirs: # visited directory |
819 d = f + '/' |
819 d = f + '/' |
820 i = bisect.bisect(files, d) |
820 for mf in matched: |
821 if i >= len(files) or not files[i].startswith(d): |
821 if mf.startswith(d): |
|
822 break |
|
823 else: |
822 fail(f, _("no match under directory!")) |
824 fail(f, _("no match under directory!")) |
823 elif f not in self.dirstate: |
825 elif f not in self.dirstate: |
824 fail(f, _("file not tracked!")) |
826 fail(f, _("file not tracked!")) |
825 |
827 |
826 if (not force and not extra.get("close") and p2 == nullid |
828 if (not force and not extra.get("close") and p2 == nullid |