Mercurial > hg
changeset 20982:1df99f1ea28d
shelve: add "applybundle()" to invoke "readbundle()" with relative path and vfs
"applybundle()" also includes "addchangegroup()" invocation to
encapsulate "vfs.join()" inside it.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 09 Mar 2014 01:03:28 +0900 |
parents | 4fdd1172d37e |
children | 2778616de7ce |
files | hgext/shelve.py |
diffstat | 1 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Sun Mar 09 01:03:28 2014 +0900 +++ b/hgext/shelve.py Sun Mar 09 01:03:28 2014 +0900 @@ -68,6 +68,15 @@ raise raise util.Abort(_("shelved change '%s' not found") % self.name) + def applybundle(self): + fp = self.opener() + try: + gen = changegroup.readbundle(fp, self.fname, self.vfs) + changegroup.addchangegroup(self.repo, gen, 'unshelve', + 'bundle:' + self.vfs.join(self.fname)) + finally: + fp.close() + class shelvedstate(object): """Handle persistence during unshelving operations. @@ -560,16 +569,10 @@ node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) tmpwctx = repo[node] - try: - ui.quiet = True - fp = shelvedfile(repo, basename, 'hg').opener() - gen = changegroup.readbundle(fp, fp.name) - changegroup.addchangegroup(repo, gen, 'unshelve', - 'bundle:' + fp.name) - nodes = [ctx.node() for ctx in repo.set('%d:', oldtiprev)] - phases.retractboundary(repo, phases.secret, nodes) - finally: - fp.close() + ui.quiet = True + shelvedfile(repo, basename, 'hg').applybundle() + nodes = [ctx.node() for ctx in repo.set('%d:', oldtiprev)] + phases.retractboundary(repo, phases.secret, nodes) ui.quiet = oldquiet