equal
deleted
inserted
replaced
446 self.ui.warn(_('malformated mq status line: %s\n') % entry) |
446 self.ui.warn(_('malformated mq status line: %s\n') % entry) |
447 # else we ignore empty lines |
447 # else we ignore empty lines |
448 try: |
448 try: |
449 lines = self.opener.read(self.statuspath).splitlines() |
449 lines = self.opener.read(self.statuspath).splitlines() |
450 return list(parselines(lines)) |
450 return list(parselines(lines)) |
451 except IOError, e: |
451 except IOError as e: |
452 if e.errno == errno.ENOENT: |
452 if e.errno == errno.ENOENT: |
453 return [] |
453 return [] |
454 raise |
454 raise |
455 |
455 |
456 @util.propertycache |
456 @util.propertycache |
457 def fullseries(self): |
457 def fullseries(self): |
458 try: |
458 try: |
459 return self.opener.read(self.seriespath).splitlines() |
459 return self.opener.read(self.seriespath).splitlines() |
460 except IOError, e: |
460 except IOError as e: |
461 if e.errno == errno.ENOENT: |
461 if e.errno == errno.ENOENT: |
462 return [] |
462 return [] |
463 raise |
463 raise |
464 |
464 |
465 @util.propertycache |
465 @util.propertycache |
572 def active(self): |
572 def active(self): |
573 if self.activeguards is None: |
573 if self.activeguards is None: |
574 self.activeguards = [] |
574 self.activeguards = [] |
575 try: |
575 try: |
576 guards = self.opener.read(self.guardspath).split() |
576 guards = self.opener.read(self.guardspath).split() |
577 except IOError, err: |
577 except IOError as err: |
578 if err.errno != errno.ENOENT: |
578 if err.errno != errno.ENOENT: |
579 raise |
579 raise |
580 guards = [] |
580 guards = [] |
581 for i, guard in enumerate(guards): |
581 for i, guard in enumerate(guards): |
582 bad = self.checkguard(guard) |
582 bad = self.checkguard(guard) |
673 undo = repo.sjoin('undo') |
673 undo = repo.sjoin('undo') |
674 if not os.path.exists(undo): |
674 if not os.path.exists(undo): |
675 return |
675 return |
676 try: |
676 try: |
677 os.unlink(undo) |
677 os.unlink(undo) |
678 except OSError, inst: |
678 except OSError as inst: |
679 self.ui.warn(_('error removing undo: %s\n') % str(inst)) |
679 self.ui.warn(_('error removing undo: %s\n') % str(inst)) |
680 |
680 |
681 def backup(self, repo, files, copy=False): |
681 def backup(self, repo, files, copy=False): |
682 # backup local changes in --force case |
682 # backup local changes in --force case |
683 for f in sorted(files): |
683 for f in sorted(files): |
802 files = set() |
802 files = set() |
803 try: |
803 try: |
804 fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1, |
804 fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1, |
805 files=files, eolmode=None) |
805 files=files, eolmode=None) |
806 return (True, list(files), fuzz) |
806 return (True, list(files), fuzz) |
807 except Exception, inst: |
807 except Exception as inst: |
808 self.ui.note(str(inst) + '\n') |
808 self.ui.note(str(inst) + '\n') |
809 if not self.ui.verbose: |
809 if not self.ui.verbose: |
810 self.ui.warn(_("patch failed, unable to continue (try -v)\n")) |
810 self.ui.warn(_("patch failed, unable to continue (try -v)\n")) |
811 self.ui.traceback() |
811 self.ui.traceback() |
812 return (False, list(files), False) |
812 return (False, list(files), False) |
957 if r: |
957 if r: |
958 r[None].forget(patches) |
958 r[None].forget(patches) |
959 for p in patches: |
959 for p in patches: |
960 try: |
960 try: |
961 os.unlink(self.join(p)) |
961 os.unlink(self.join(p)) |
962 except OSError, inst: |
962 except OSError as inst: |
963 if inst.errno != errno.ENOENT: |
963 if inst.errno != errno.ENOENT: |
964 raise |
964 raise |
965 |
965 |
966 qfinished = [] |
966 qfinished = [] |
967 if numrevs: |
967 if numrevs: |
1157 wlock = repo.wlock() |
1157 wlock = repo.wlock() |
1158 try: |
1158 try: |
1159 try: |
1159 try: |
1160 # if patch file write fails, abort early |
1160 # if patch file write fails, abort early |
1161 p = self.opener(patchfn, "w") |
1161 p = self.opener(patchfn, "w") |
1162 except IOError, e: |
1162 except IOError as e: |
1163 raise util.Abort(_('cannot write patch "%s": %s') |
1163 raise util.Abort(_('cannot write patch "%s": %s') |
1164 % (patchfn, e.strerror)) |
1164 % (patchfn, e.strerror)) |
1165 try: |
1165 try: |
1166 defaultmsg = "[mq]: %s" % patchfn |
1166 defaultmsg = "[mq]: %s" % patchfn |
1167 editor = cmdutil.getcommiteditor(editform=editform) |
1167 editor = cmdutil.getcommiteditor(editform=editform) |
1814 def init(self, repo, create=False): |
1814 def init(self, repo, create=False): |
1815 if not create and os.path.isdir(self.path): |
1815 if not create and os.path.isdir(self.path): |
1816 raise util.Abort(_("patch queue directory already exists")) |
1816 raise util.Abort(_("patch queue directory already exists")) |
1817 try: |
1817 try: |
1818 os.mkdir(self.path) |
1818 os.mkdir(self.path) |
1819 except OSError, inst: |
1819 except OSError as inst: |
1820 if inst.errno != errno.EEXIST or not create: |
1820 if inst.errno != errno.EEXIST or not create: |
1821 raise |
1821 raise |
1822 if create: |
1822 if create: |
1823 return self.qrepo(create=True) |
1823 return self.qrepo(create=True) |
1824 |
1824 |