comparison mercurial/commands.py @ 21063:7ca4f2049d3b

bundle2: move `readbundle` into the `exchange` module The `readbundle` function is going to understand the bundle2 header. We move the function to a more suitable place before making any other changes.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 14 Apr 2014 15:33:50 -0400
parents 1004d3cd65fd
children 4d9d490d7bbe
comparison
equal deleted inserted replaced
21062:e7c0a65a5c9c 21063:7ca4f2049d3b
18 import merge as mergemod 18 import merge as mergemod
19 import minirst, revset, fileset 19 import minirst, revset, fileset
20 import dagparser, context, simplemerge, graphmod 20 import dagparser, context, simplemerge, graphmod
21 import random 21 import random
22 import setdiscovery, treediscovery, dagutil, pvec, localrepo 22 import setdiscovery, treediscovery, dagutil, pvec, localrepo
23 import phases, obsolete 23 import phases, obsolete, exchange
24 24
25 table = {} 25 table = {}
26 26
27 command = cmdutil.command(table) 27 command = cmdutil.command(table)
28 28
1734 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE')) 1734 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE'))
1735 def debugbundle(ui, bundlepath, all=None, **opts): 1735 def debugbundle(ui, bundlepath, all=None, **opts):
1736 """lists the contents of a bundle""" 1736 """lists the contents of a bundle"""
1737 f = hg.openpath(ui, bundlepath) 1737 f = hg.openpath(ui, bundlepath)
1738 try: 1738 try:
1739 gen = changegroup.readbundle(f, bundlepath) 1739 gen = exchange.readbundle(f, bundlepath)
1740 if all: 1740 if all:
1741 ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n")) 1741 ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n"))
1742 1742
1743 def showchunks(named): 1743 def showchunks(named):
1744 ui.write("\n%s\n" % named) 1744 ui.write("\n%s\n" % named)
5805 lock = repo.lock() 5805 lock = repo.lock()
5806 wc = repo['.'] 5806 wc = repo['.']
5807 try: 5807 try:
5808 for fname in fnames: 5808 for fname in fnames:
5809 f = hg.openpath(ui, fname) 5809 f = hg.openpath(ui, fname)
5810 gen = changegroup.readbundle(f, fname) 5810 gen = exchange.readbundle(f, fname)
5811 modheads = changegroup.addchangegroup(repo, gen, 'unbundle', 5811 modheads = changegroup.addchangegroup(repo, gen, 'unbundle',
5812 'bundle:' + fname) 5812 'bundle:' + fname)
5813 finally: 5813 finally:
5814 lock.release() 5814 lock.release()
5815 bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch()) 5815 bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch())