Show More
@@ -137,7 +137,7 b' class shelvedfile(object):' | |||||
137 | raise |
|
137 | raise | |
138 | raise error.Abort(_("shelved change '%s' not found") % self.name) |
|
138 | raise error.Abort(_("shelved change '%s' not found") % self.name) | |
139 |
|
139 | |||
140 | def applybundle(self): |
|
140 | def applybundle(self, tr): | |
141 | fp = self.opener() |
|
141 | fp = self.opener() | |
142 | try: |
|
142 | try: | |
143 | targetphase = phases.internal |
|
143 | targetphase = phases.internal | |
@@ -145,7 +145,6 b' class shelvedfile(object):' | |||||
145 | targetphase = phases.secret |
|
145 | targetphase = phases.secret | |
146 | gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) |
|
146 | gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) | |
147 | pretip = self.repo['tip'] |
|
147 | pretip = self.repo['tip'] | |
148 | tr = self.repo.currenttransaction() |
|
|||
149 | bundle2.applybundle(self.repo, gen, tr, |
|
148 | bundle2.applybundle(self.repo, gen, tr, | |
150 | source='unshelve', |
|
149 | source='unshelve', | |
151 | url='bundle:' + self.vfs.join(self.fname), |
|
150 | url='bundle:' + self.vfs.join(self.fname), | |
@@ -324,10 +323,9 b' def _restoreactivebookmark(repo, mark):' | |||||
324 | if mark: |
|
323 | if mark: | |
325 | bookmarks.activate(repo, mark) |
|
324 | bookmarks.activate(repo, mark) | |
326 |
|
325 | |||
327 | def _aborttransaction(repo): |
|
326 | def _aborttransaction(repo, tr): | |
328 | '''Abort current transaction for shelve/unshelve, but keep dirstate |
|
327 | '''Abort current transaction for shelve/unshelve, but keep dirstate | |
329 | ''' |
|
328 | ''' | |
330 | tr = repo.currenttransaction() |
|
|||
331 | dirstatebackupname = 'dirstate.shelve' |
|
329 | dirstatebackupname = 'dirstate.shelve' | |
332 | narrowspecbackupname = 'narrowspec.shelve' |
|
330 | narrowspecbackupname = 'narrowspec.shelve' | |
333 | repo.dirstate.savebackup(tr, dirstatebackupname) |
|
331 | repo.dirstate.savebackup(tr, dirstatebackupname) | |
@@ -444,12 +442,11 b' def _includeunknownfiles(repo, pats, opt' | |||||
444 | extra['shelve_unknown'] = '\0'.join(s.unknown) |
|
442 | extra['shelve_unknown'] = '\0'.join(s.unknown) | |
445 | repo[None].add(s.unknown) |
|
443 | repo[None].add(s.unknown) | |
446 |
|
444 | |||
447 | def _finishshelve(repo): |
|
445 | def _finishshelve(repo, tr): | |
448 | if phases.supportinternal(repo): |
|
446 | if phases.supportinternal(repo): | |
449 | tr = repo.currenttransaction() |
|
|||
450 | tr.close() |
|
447 | tr.close() | |
451 | else: |
|
448 | else: | |
452 | _aborttransaction(repo) |
|
449 | _aborttransaction(repo, tr) | |
453 |
|
450 | |||
454 | def createcmd(ui, repo, pats, opts): |
|
451 | def createcmd(ui, repo, pats, opts): | |
455 | """subcommand that creates a new shelve""" |
|
452 | """subcommand that creates a new shelve""" | |
@@ -516,7 +513,7 b' def _docreatecmd(ui, repo, pats, opts):' | |||||
516 | if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): |
|
513 | if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): | |
517 | repo.dirstate.setbranch(origbranch) |
|
514 | repo.dirstate.setbranch(origbranch) | |
518 |
|
515 | |||
519 | _finishshelve(repo) |
|
516 | _finishshelve(repo, tr) | |
520 | finally: |
|
517 | finally: | |
521 | _restoreactivebookmark(repo, activebookmark) |
|
518 | _restoreactivebookmark(repo, activebookmark) | |
522 | lockmod.release(tr, lock) |
|
519 | lockmod.release(tr, lock) | |
@@ -791,7 +788,7 b' def _commitworkingcopychanges(ui, repo, ' | |||||
791 | tmpwctx = repo[node] |
|
788 | tmpwctx = repo[node] | |
792 | return tmpwctx, addedbefore |
|
789 | return tmpwctx, addedbefore | |
793 |
|
790 | |||
794 | def _unshelverestorecommit(ui, repo, basename): |
|
791 | def _unshelverestorecommit(ui, repo, tr, basename): | |
795 | """Recreate commit in the repository during the unshelve""" |
|
792 | """Recreate commit in the repository during the unshelve""" | |
796 | repo = repo.unfiltered() |
|
793 | repo = repo.unfiltered() | |
797 | node = None |
|
794 | node = None | |
@@ -799,7 +796,7 b' def _unshelverestorecommit(ui, repo, bas' | |||||
799 | node = shelvedfile(repo, basename, 'shelve').readinfo()['node'] |
|
796 | node = shelvedfile(repo, basename, 'shelve').readinfo()['node'] | |
800 | if node is None or node not in repo: |
|
797 | if node is None or node not in repo: | |
801 | with ui.configoverride({('ui', 'quiet'): True}): |
|
798 | with ui.configoverride({('ui', 'quiet'): True}): | |
802 | shelvectx = shelvedfile(repo, basename, 'hg').applybundle() |
|
799 | shelvectx = shelvedfile(repo, basename, 'hg').applybundle(tr) | |
803 | # We might not strip the unbundled changeset, so we should keep track of |
|
800 | # We might not strip the unbundled changeset, so we should keep track of | |
804 | # the unshelve node in case we need to reuse it (eg: unshelve --keep) |
|
801 | # the unshelve node in case we need to reuse it (eg: unshelve --keep) | |
805 | if node is None: |
|
802 | if node is None: | |
@@ -879,7 +876,7 b' def _finishunshelve(repo, oldtiprev, tr,' | |||||
879 | # hooks still fire and try to operate on the missing commits. |
|
876 | # hooks still fire and try to operate on the missing commits. | |
880 | # Clean up manually to prevent this. |
|
877 | # Clean up manually to prevent this. | |
881 | repo.unfiltered().changelog.strip(oldtiprev, tr) |
|
878 | repo.unfiltered().changelog.strip(oldtiprev, tr) | |
882 | _aborttransaction(repo) |
|
879 | _aborttransaction(repo, tr) | |
883 |
|
880 | |||
884 | def _checkunshelveuntrackedproblems(ui, repo, shelvectx): |
|
881 | def _checkunshelveuntrackedproblems(ui, repo, shelvectx): | |
885 | """Check potential problems which may result from working |
|
882 | """Check potential problems which may result from working | |
@@ -1023,7 +1020,7 b' def _dounshelve(ui, repo, *shelved, **op' | |||||
1023 | activebookmark = _backupactivebookmark(repo) |
|
1020 | activebookmark = _backupactivebookmark(repo) | |
1024 | tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts, |
|
1021 | tmpwctx, addedbefore = _commitworkingcopychanges(ui, repo, opts, | |
1025 | tmpwctx) |
|
1022 | tmpwctx) | |
1026 | repo, shelvectx = _unshelverestorecommit(ui, repo, basename) |
|
1023 | repo, shelvectx = _unshelverestorecommit(ui, repo, tr, basename) | |
1027 | _checkunshelveuntrackedproblems(ui, repo, shelvectx) |
|
1024 | _checkunshelveuntrackedproblems(ui, repo, shelvectx) | |
1028 | branchtorestore = '' |
|
1025 | branchtorestore = '' | |
1029 | if shelvectx.branch() != shelvectx.p1().branch(): |
|
1026 | if shelvectx.branch() != shelvectx.p1().branch(): |
General Comments 0
You need to be logged in to leave comments.
Login now