Mercurial > hg
comparison hgext/shelve.py @ 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 | 8e5b21ce8ee9 |
children | 2778616de7ce |
comparison
equal
deleted
inserted
replaced
20981:4fdd1172d37e | 20982:1df99f1ea28d |
---|---|
65 return self.vfs(self.fname, mode) | 65 return self.vfs(self.fname, mode) |
66 except IOError, err: | 66 except IOError, err: |
67 if err.errno != errno.ENOENT: | 67 if err.errno != errno.ENOENT: |
68 raise | 68 raise |
69 raise util.Abort(_("shelved change '%s' not found") % self.name) | 69 raise util.Abort(_("shelved change '%s' not found") % self.name) |
70 | |
71 def applybundle(self): | |
72 fp = self.opener() | |
73 try: | |
74 gen = changegroup.readbundle(fp, self.fname, self.vfs) | |
75 changegroup.addchangegroup(self.repo, gen, 'unshelve', | |
76 'bundle:' + self.vfs.join(self.fname)) | |
77 finally: | |
78 fp.close() | |
70 | 79 |
71 class shelvedstate(object): | 80 class shelvedstate(object): |
72 """Handle persistence during unshelving operations. | 81 """Handle persistence during unshelving operations. |
73 | 82 |
74 Handles saving and restoring a shelved state. Ensures that different | 83 Handles saving and restoring a shelved state. Ensures that different |
558 tempopts['date'] = opts.get('date') | 567 tempopts['date'] = opts.get('date') |
559 ui.quiet = True | 568 ui.quiet = True |
560 node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) | 569 node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) |
561 tmpwctx = repo[node] | 570 tmpwctx = repo[node] |
562 | 571 |
563 try: | 572 ui.quiet = True |
564 ui.quiet = True | 573 shelvedfile(repo, basename, 'hg').applybundle() |
565 fp = shelvedfile(repo, basename, 'hg').opener() | 574 nodes = [ctx.node() for ctx in repo.set('%d:', oldtiprev)] |
566 gen = changegroup.readbundle(fp, fp.name) | 575 phases.retractboundary(repo, phases.secret, nodes) |
567 changegroup.addchangegroup(repo, gen, 'unshelve', | |
568 'bundle:' + fp.name) | |
569 nodes = [ctx.node() for ctx in repo.set('%d:', oldtiprev)] | |
570 phases.retractboundary(repo, phases.secret, nodes) | |
571 finally: | |
572 fp.close() | |
573 | 576 |
574 ui.quiet = oldquiet | 577 ui.quiet = oldquiet |
575 | 578 |
576 shelvectx = repo['tip'] | 579 shelvectx = repo['tip'] |
577 | 580 |