Show More
@@ -44,7 +44,6 b' from mercurial import (' | |||||
44 | phases, |
|
44 | phases, | |
45 | registrar, |
|
45 | registrar, | |
46 | repair, |
|
46 | repair, | |
47 | repoview, |
|
|||
48 | revset, |
|
47 | revset, | |
49 | revsetlang, |
|
48 | revsetlang, | |
50 | scmutil, |
|
49 | scmutil, | |
@@ -137,7 +136,17 b' class rebaseruntime(object):' | |||||
137 | if opts is None: |
|
136 | if opts is None: | |
138 | opts = {} |
|
137 | opts = {} | |
139 |
|
138 | |||
140 | self.repo = repo |
|
139 | # prepared: whether we have rebasestate prepared or not. Currently it | |
|
140 | # decides whether "self.repo" is unfiltered or not. | |||
|
141 | # The rebasestate has explicit hash to hash instructions not depending | |||
|
142 | # on visibility. If rebasestate exists (in-memory or on-disk), use | |||
|
143 | # unfiltered repo to avoid visibility issues. | |||
|
144 | # Before knowing rebasestate (i.e. when starting a new rebase (not | |||
|
145 | # --continue or --abort)), the original repo should be used so | |||
|
146 | # visibility-dependent revsets are correct. | |||
|
147 | self.prepared = False | |||
|
148 | self._repo = repo | |||
|
149 | ||||
141 | self.ui = ui |
|
150 | self.ui = ui | |
142 | self.opts = opts |
|
151 | self.opts = opts | |
143 | self.originalwd = None |
|
152 | self.originalwd = None | |
@@ -166,6 +175,13 b' class rebaseruntime(object):' | |||||
166 | self.keepopen = opts.get('keepopen', False) |
|
175 | self.keepopen = opts.get('keepopen', False) | |
167 | self.obsoletenotrebased = {} |
|
176 | self.obsoletenotrebased = {} | |
168 |
|
177 | |||
|
178 | @property | |||
|
179 | def repo(self): | |||
|
180 | if self.prepared: | |||
|
181 | return self._repo.unfiltered() | |||
|
182 | else: | |||
|
183 | return self._repo | |||
|
184 | ||||
169 | def storestatus(self, tr=None): |
|
185 | def storestatus(self, tr=None): | |
170 | """Store the current status to allow recovery""" |
|
186 | """Store the current status to allow recovery""" | |
171 | if tr: |
|
187 | if tr: | |
@@ -198,6 +214,7 b' class rebaseruntime(object):' | |||||
198 |
|
214 | |||
199 | def restorestatus(self): |
|
215 | def restorestatus(self): | |
200 | """Restore a previously stored status""" |
|
216 | """Restore a previously stored status""" | |
|
217 | self.prepared = True | |||
201 | repo = self.repo.unfiltered() |
|
218 | repo = self.repo.unfiltered() | |
202 | keepbranches = None |
|
219 | keepbranches = None | |
203 | legacydest = None |
|
220 | legacydest = None | |
@@ -266,7 +283,6 b' class rebaseruntime(object):' | |||||
266 | repo.ui.debug('computed skipped revs: %s\n' % |
|
283 | repo.ui.debug('computed skipped revs: %s\n' % | |
267 | (' '.join(str(r) for r in sorted(skipped)) or None)) |
|
284 | (' '.join(str(r) for r in sorted(skipped)) or None)) | |
268 | repo.ui.debug('rebase status resumed\n') |
|
285 | repo.ui.debug('rebase status resumed\n') | |
269 | _setrebasesetvisibility(repo, set(state.keys()) | {originalwd}) |
|
|||
270 |
|
286 | |||
271 | self.originalwd = originalwd |
|
287 | self.originalwd = originalwd | |
272 | self.destmap = destmap |
|
288 | self.destmap = destmap | |
@@ -356,6 +372,8 b' class rebaseruntime(object):' | |||||
356 | if dest.closesbranch() and not self.keepbranchesf: |
|
372 | if dest.closesbranch() and not self.keepbranchesf: | |
357 | self.ui.status(_('reopening closed branch head %s\n') % dest) |
|
373 | self.ui.status(_('reopening closed branch head %s\n') % dest) | |
358 |
|
374 | |||
|
375 | self.prepared = True | |||
|
376 | ||||
359 | def _performrebase(self, tr): |
|
377 | def _performrebase(self, tr): | |
360 | repo, ui = self.repo, self.ui |
|
378 | repo, ui = self.repo, self.ui | |
361 | if self.keepbranchesf: |
|
379 | if self.keepbranchesf: | |
@@ -1323,7 +1341,6 b' def restorecollapsemsg(repo, isabort):' | |||||
1323 |
|
1341 | |||
1324 | def clearstatus(repo): |
|
1342 | def clearstatus(repo): | |
1325 | 'Remove the status files' |
|
1343 | 'Remove the status files' | |
1326 | _clearrebasesetvisibiliy(repo) |
|
|||
1327 | # Make sure the active transaction won't write the state file |
|
1344 | # Make sure the active transaction won't write the state file | |
1328 | tr = repo.currenttransaction() |
|
1345 | tr = repo.currenttransaction() | |
1329 | if tr: |
|
1346 | if tr: | |
@@ -1438,7 +1455,6 b' def buildstate(repo, destmap, collapse):' | |||||
1438 | ''' |
|
1455 | ''' | |
1439 | rebaseset = destmap.keys() |
|
1456 | rebaseset = destmap.keys() | |
1440 | originalwd = repo['.'].rev() |
|
1457 | originalwd = repo['.'].rev() | |
1441 | _setrebasesetvisibility(repo, set(rebaseset) | {originalwd}) |
|
|||
1442 |
|
1458 | |||
1443 | # This check isn't strictly necessary, since mq detects commits over an |
|
1459 | # This check isn't strictly necessary, since mq detects commits over an | |
1444 | # applied patch. But it prevents messing up the working directory when |
|
1460 | # applied patch. But it prevents messing up the working directory when | |
@@ -1580,30 +1596,6 b' def pullrebase(orig, ui, repo, *args, **' | |||||
1580 |
|
1596 | |||
1581 | return ret |
|
1597 | return ret | |
1582 |
|
1598 | |||
1583 | def _setrebasesetvisibility(repo, revs): |
|
|||
1584 | """store the currently rebased set on the repo object |
|
|||
1585 |
|
||||
1586 | This is used by another function to prevent rebased revision to because |
|
|||
1587 | hidden (see issue4504)""" |
|
|||
1588 | repo = repo.unfiltered() |
|
|||
1589 | repo._rebaseset = revs |
|
|||
1590 | # invalidate cache if visibility changes |
|
|||
1591 | hiddens = repo.filteredrevcache.get('visible', set()) |
|
|||
1592 | if revs & hiddens: |
|
|||
1593 | repo.invalidatevolatilesets() |
|
|||
1594 |
|
||||
1595 | def _clearrebasesetvisibiliy(repo): |
|
|||
1596 | """remove rebaseset data from the repo""" |
|
|||
1597 | repo = repo.unfiltered() |
|
|||
1598 | if '_rebaseset' in vars(repo): |
|
|||
1599 | del repo._rebaseset |
|
|||
1600 |
|
||||
1601 | def _rebasedvisible(orig, repo): |
|
|||
1602 | """ensure rebased revs stay visible (see issue4504)""" |
|
|||
1603 | blockers = orig(repo) |
|
|||
1604 | blockers.update(getattr(repo, '_rebaseset', ())) |
|
|||
1605 | return blockers |
|
|||
1606 |
|
||||
1607 | def _filterobsoleterevs(repo, revs): |
|
1599 | def _filterobsoleterevs(repo, revs): | |
1608 | """returns a set of the obsolete revisions in revs""" |
|
1600 | """returns a set of the obsolete revisions in revs""" | |
1609 | return set(r for r in revs if repo[r].obsolete()) |
|
1601 | return set(r for r in revs if repo[r].obsolete()) | |
@@ -1668,5 +1660,3 b' def uisetup(ui):' | |||||
1668 | _("use 'hg rebase --continue' or 'hg rebase --abort'")]) |
|
1660 | _("use 'hg rebase --continue' or 'hg rebase --abort'")]) | |
1669 | cmdutil.afterresolvedstates.append( |
|
1661 | cmdutil.afterresolvedstates.append( | |
1670 | ['rebasestate', _('hg rebase --continue')]) |
|
1662 | ['rebasestate', _('hg rebase --continue')]) | |
1671 | # ensure rebased rev are not hidden |
|
|||
1672 | extensions.wrapfunction(repoview, 'pinnedrevs', _rebasedvisible) |
|
General Comments 0
You need to be logged in to leave comments.
Login now