Mercurial > hg
comparison hgext/shelve.py @ 26799:ae03d4190321
shelve: properly process bundle2 bundle
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 19 Oct 2015 15:42:50 +0200 |
parents | 008761affe3f |
children | d55d22840592 |
comparison
equal
deleted
inserted
replaced
26798:38dcb85f9370 | 26799:ae03d4190321 |
---|---|
25 import itertools | 25 import itertools |
26 from mercurial.i18n import _ | 26 from mercurial.i18n import _ |
27 from mercurial.node import nullid, nullrev, bin, hex | 27 from mercurial.node import nullid, nullrev, bin, hex |
28 from mercurial import changegroup, cmdutil, scmutil, phases, commands | 28 from mercurial import changegroup, cmdutil, scmutil, phases, commands |
29 from mercurial import error, hg, mdiff, merge, patch, repair, util | 29 from mercurial import error, hg, mdiff, merge, patch, repair, util |
30 from mercurial import templatefilters, exchange, bundlerepo | 30 from mercurial import templatefilters, exchange, bundlerepo, bundle2 |
31 from mercurial import lock as lockmod | 31 from mercurial import lock as lockmod |
32 from hgext import rebase | 32 from hgext import rebase |
33 import errno | 33 import errno |
34 | 34 |
35 cmdtable = {} | 35 cmdtable = {} |
94 | 94 |
95 def applybundle(self): | 95 def applybundle(self): |
96 fp = self.opener() | 96 fp = self.opener() |
97 try: | 97 try: |
98 gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) | 98 gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) |
99 gen.apply(self.repo, 'unshelve', | 99 if not isinstance(gen, bundle2.unbundle20): |
100 'bundle:' + self.vfs.join(self.fname), | 100 gen.apply(self.repo, 'unshelve', |
101 targetphase=phases.secret) | 101 'bundle:' + self.vfs.join(self.fname), |
102 targetphase=phases.secret) | |
103 if isinstance(gen, bundle2.unbundle20): | |
104 bundle2.applybundle(self.repo, gen, | |
105 self.repo.currenttransaction(), | |
106 source='unshelve', | |
107 url='bundle:' + self.vfs.join(self.fname)) | |
102 finally: | 108 finally: |
103 fp.close() | 109 fp.close() |
104 | 110 |
105 def bundlerepo(self): | 111 def bundlerepo(self): |
106 return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, | 112 return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, |