1095 changes[0].append('.hgsubstate') |
1095 changes[0].append('.hgsubstate') |
1096 |
1096 |
1097 def checklocalchanges(self, repo, force=False, refresh=True): |
1097 def checklocalchanges(self, repo, force=False, refresh=True): |
1098 excsuffix = '' |
1098 excsuffix = '' |
1099 if refresh: |
1099 if refresh: |
1100 excsuffix = ', refresh first' |
1100 excsuffix = ', qrefresh first' |
1101 # plain versions for i18n tool to detect them |
1101 # plain versions for i18n tool to detect them |
1102 _("local changes found, refresh first") |
1102 _("local changes found, qrefresh first") |
1103 _("local changed subrepos found, refresh first") |
1103 _("local changed subrepos found, qrefresh first") |
1104 return checklocalchanges(repo, force, excsuffix) |
1104 return checklocalchanges(repo, force, excsuffix) |
1105 |
1105 |
1106 _reserved = ('series', 'status', 'guards', '.', '..') |
1106 _reserved = ('series', 'status', 'guards', '.', '..') |
1107 def checkreservedname(self, name): |
1107 def checkreservedname(self, name): |
1108 if name in self._reserved: |
1108 if name in self._reserved: |
1452 |
1452 |
1453 if not self.applied: |
1453 if not self.applied: |
1454 return ret[0] |
1454 return ret[0] |
1455 top = self.applied[-1].name |
1455 top = self.applied[-1].name |
1456 if ret[0] and ret[0] > 1: |
1456 if ret[0] and ret[0] > 1: |
1457 msg = _("errors during apply, please fix and refresh %s\n") |
1457 msg = _("errors during apply, please fix and qrefresh %s\n") |
1458 self.ui.write(msg % top) |
1458 self.ui.write(msg % top) |
1459 else: |
1459 else: |
1460 self.ui.write(_("now at: %s\n") % top) |
1460 self.ui.write(_("now at: %s\n") % top) |
1461 return ret[0] |
1461 return ret[0] |
1462 |
1462 |
1547 if d: |
1547 if d: |
1548 raise error.Abort(_("deletions found between repo revs")) |
1548 raise error.Abort(_("deletions found between repo revs")) |
1549 |
1549 |
1550 tobackup = set(a + m + r) & tobackup |
1550 tobackup = set(a + m + r) & tobackup |
1551 if keepchanges and tobackup: |
1551 if keepchanges and tobackup: |
1552 raise error.Abort(_("local changes found, refresh first")) |
1552 raise error.Abort(_("local changes found, qrefresh first")) |
1553 self.backup(repo, tobackup) |
1553 self.backup(repo, tobackup) |
1554 repo.dirstate.beginparentchange() |
1554 repo.dirstate.beginparentchange() |
1555 for f in a: |
1555 for f in a: |
1556 util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
1556 util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
1557 repo.dirstate.drop(f) |
1557 repo.dirstate.drop(f) |
1602 |
1602 |
1603 try: |
1603 try: |
1604 self.checktoppatch(repo) |
1604 self.checktoppatch(repo) |
1605 (top, patchfn) = (self.applied[-1].node, self.applied[-1].name) |
1605 (top, patchfn) = (self.applied[-1].node, self.applied[-1].name) |
1606 if repo.changelog.heads(top) != [top]: |
1606 if repo.changelog.heads(top) != [top]: |
1607 raise error.Abort(_("cannot refresh a revision with children")) |
1607 raise error.Abort(_("cannot qrefresh a revision with children")) |
1608 if not repo[top].mutable(): |
1608 if not repo[top].mutable(): |
1609 raise error.Abort(_("cannot refresh public revision"), |
1609 raise error.Abort(_("cannot qrefresh public revision"), |
1610 hint=_('see "hg help phases" for details')) |
1610 hint=_('see "hg help phases" for details')) |
1611 |
1611 |
1612 cparents = repo.changelog.parents(top) |
1612 cparents = repo.changelog.parents(top) |
1613 patchparent = self.qparents(repo, top) |
1613 patchparent = self.qparents(repo, top) |
1614 |
1614 |
1812 self.applied.append(statusentry(n, patchfn)) |
1812 self.applied.append(statusentry(n, patchfn)) |
1813 except: # re-raises |
1813 except: # re-raises |
1814 ctx = repo[cparents[0]] |
1814 ctx = repo[cparents[0]] |
1815 repo.dirstate.rebuild(ctx.node(), ctx.manifest()) |
1815 repo.dirstate.rebuild(ctx.node(), ctx.manifest()) |
1816 self.savedirty() |
1816 self.savedirty() |
1817 self.ui.warn(_('refresh interrupted while patch was popped! ' |
1817 self.ui.warn(_('qrefresh interrupted while patch was popped! ' |
1818 '(revert --all, qpush to recover)\n')) |
1818 '(revert --all, qpush to recover)\n')) |
1819 raise |
1819 raise |
1820 finally: |
1820 finally: |
1821 wlock.release() |
1821 wlock.release() |
1822 self.removeundo(repo) |
1822 self.removeundo(repo) |