Mercurial > hg
comparison hgext/shelve.py @ 33039:b82615afde65
bundle: add a applybundle1() method
This is one step towards removing a bunch of "if isinstance(gen,
unbundle20)" by treating bundle1 and bundle2 more similarly.
The name may sounds ironic for a method in the bundle2 module, but I
didn't think it was worth it yet to create a new 'bundle' module that
depends on the 'bundle2' module. Besides, we'll inline the method
again later.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 16 Jun 2017 10:25:11 -0700 |
parents | 4107eb8a5648 |
children | 18c2489ac96d |
comparison
equal
deleted
inserted
replaced
33038:f0efd2bffe1e | 33039:b82615afde65 |
---|---|
125 def applybundle(self): | 125 def applybundle(self): |
126 fp = self.opener() | 126 fp = self.opener() |
127 try: | 127 try: |
128 gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) | 128 gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) |
129 if not isinstance(gen, bundle2.unbundle20): | 129 if not isinstance(gen, bundle2.unbundle20): |
130 gen.apply(self.repo, self.repo.currenttransaction(), 'unshelve', | 130 bundle2.applybundle1(self.repo, gen, |
131 'bundle:' + self.vfs.join(self.fname), | 131 self.repo.currenttransaction(), |
132 targetphase=phases.secret) | 132 source='unshelve', |
133 url='bundle:' + self.vfs.join(self.fname), | |
134 targetphase=phases.secret) | |
133 else: | 135 else: |
134 bundle2.applybundle(self.repo, gen, | 136 bundle2.applybundle(self.repo, gen, |
135 self.repo.currenttransaction(), | 137 self.repo.currenttransaction(), |
136 source='unshelve', | 138 source='unshelve', |
137 url='bundle:' + self.vfs.join(self.fname)) | 139 url='bundle:' + self.vfs.join(self.fname)) |