equal
deleted
inserted
replaced
857 if (m or a or r or d) and not force: |
857 if (m or a or r or d) and not force: |
858 self.localchangesfound(refresh) |
858 self.localchangesfound(refresh) |
859 return m, a, r, d |
859 return m, a, r, d |
860 |
860 |
861 _reserved = ('series', 'status', 'guards', '.', '..') |
861 _reserved = ('series', 'status', 'guards', '.', '..') |
862 def check_reserved_name(self, name): |
862 def checkreservedname(self, name): |
863 if name in self._reserved: |
863 if name in self._reserved: |
864 raise util.Abort(_('"%s" cannot be used as the name of a patch') |
864 raise util.Abort(_('"%s" cannot be used as the name of a patch') |
865 % name) |
865 % name) |
866 for prefix in ('.hg', '.mq'): |
866 for prefix in ('.hg', '.mq'): |
867 if name.startswith(prefix): |
867 if name.startswith(prefix): |
871 if c in name: |
871 if c in name: |
872 raise util.Abort(_('"%s" cannot be used in the name of a patch') |
872 raise util.Abort(_('"%s" cannot be used in the name of a patch') |
873 % c) |
873 % c) |
874 |
874 |
875 def checkpatchname(self, name, force=False): |
875 def checkpatchname(self, name, force=False): |
876 self.check_reserved_name(name) |
876 self.checkreservedname(name) |
877 if not force and os.path.exists(self.join(name)): |
877 if not force and os.path.exists(self.join(name)): |
878 if os.path.isdir(self.join(name)): |
878 if os.path.isdir(self.join(name)): |
879 raise util.Abort(_('"%s" already exists as a directory') |
879 raise util.Abort(_('"%s" already exists as a directory') |
880 % name) |
880 % name) |
881 else: |
881 else: |
1807 for i, filename in enumerate(files): |
1807 for i, filename in enumerate(files): |
1808 if existing: |
1808 if existing: |
1809 if filename == '-': |
1809 if filename == '-': |
1810 raise util.Abort(_('-e is incompatible with import from -')) |
1810 raise util.Abort(_('-e is incompatible with import from -')) |
1811 filename = normname(filename) |
1811 filename = normname(filename) |
1812 self.check_reserved_name(filename) |
1812 self.checkreservedname(filename) |
1813 originpath = self.join(filename) |
1813 originpath = self.join(filename) |
1814 if not os.path.isfile(originpath): |
1814 if not os.path.isfile(originpath): |
1815 raise util.Abort(_("patch %s does not exist") % filename) |
1815 raise util.Abort(_("patch %s does not exist") % filename) |
1816 |
1816 |
1817 if patchname: |
1817 if patchname: |