hgext/shelve.py
changeset 20983 2778616de7ce
parent 20982 1df99f1ea28d
child 21063 7ca4f2049d3b
equal deleted inserted replaced
20982:1df99f1ea28d 20983:2778616de7ce
    74             gen = changegroup.readbundle(fp, self.fname, self.vfs)
    74             gen = changegroup.readbundle(fp, self.fname, self.vfs)
    75             changegroup.addchangegroup(self.repo, gen, 'unshelve',
    75             changegroup.addchangegroup(self.repo, gen, 'unshelve',
    76                                        'bundle:' + self.vfs.join(self.fname))
    76                                        'bundle:' + self.vfs.join(self.fname))
    77         finally:
    77         finally:
    78             fp.close()
    78             fp.close()
       
    79 
       
    80     def writebundle(self, cg):
       
    81         changegroup.writebundle(cg, self.fname, 'HG10UN', self.vfs)
    79 
    82 
    80 class shelvedstate(object):
    83 class shelvedstate(object):
    81     """Handle persistence during unshelving operations.
    84     """Handle persistence during unshelving operations.
    82 
    85 
    83     Handles saving and restoring a shelved state. Ensures that different
    86     Handles saving and restoring a shelved state. Ensures that different
   235         fp = shelvedfile(repo, name, 'files').opener('wb')
   238         fp = shelvedfile(repo, name, 'files').opener('wb')
   236         fp.write('\0'.join(shelvedfiles))
   239         fp.write('\0'.join(shelvedfiles))
   237 
   240 
   238         bases = list(publicancestors(repo[node]))
   241         bases = list(publicancestors(repo[node]))
   239         cg = changegroup.changegroupsubset(repo, bases, [node], 'shelve')
   242         cg = changegroup.changegroupsubset(repo, bases, [node], 'shelve')
   240         changegroup.writebundle(cg, shelvedfile(repo, name, 'hg').filename(),
   243         shelvedfile(repo, name, 'hg').writebundle(cg)
   241                                 'HG10UN')
       
   242         cmdutil.export(repo, [node],
   244         cmdutil.export(repo, [node],
   243                        fp=shelvedfile(repo, name, 'patch').opener('wb'),
   245                        fp=shelvedfile(repo, name, 'patch').opener('wb'),
   244                        opts=mdiff.diffopts(git=True))
   246                        opts=mdiff.diffopts(git=True))
   245 
   247 
   246 
   248