comparison hgext/infinitepush/common.py @ 37193:5a9692d0d6fc

infinitepush: drop the scratchbookmarksparttype bundle2 part The scratchbookmarksparttype bundle2 part was used in backupcommands.py which we deleted in an earlier changeset. We don't need this part anymore. Moreover we now have bookmarks bundle2 part in core which we can use. This patch also drops the related encoding and decoding functions. Differential Revision: https://phab.mercurial-scm.org/D2102
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 08 Feb 2018 17:27:47 +0530
parents 03ff17a4bf53
children aac4be30e250
comparison
equal deleted inserted replaced
37192:e702ca152b33 37193:5a9692d0d6fc
3 # This software may be used and distributed according to the terms of the 3 # This software may be used and distributed according to the terms of the
4 # GNU General Public License version 2 or any later version. 4 # GNU General Public License version 2 or any later version.
5 5
6 from __future__ import absolute_import 6 from __future__ import absolute_import
7 7
8 import json
9 import os 8 import os
10 import struct
11 import tempfile 9 import tempfile
12 10
13 from mercurial.node import hex 11 from mercurial.node import hex
14 12
15 from mercurial import ( 13 from mercurial import (
18 ) 16 )
19 17
20 def isremotebooksenabled(ui): 18 def isremotebooksenabled(ui):
21 return ('remotenames' in extensions._extensions and 19 return ('remotenames' in extensions._extensions and
22 ui.configbool('remotenames', 'bookmarks')) 20 ui.configbool('remotenames', 'bookmarks'))
23
24 def encodebookmarks(bookmarks):
25 encoded = {}
26 for bookmark, node in bookmarks.iteritems():
27 encoded[bookmark] = node
28 dumped = json.dumps(encoded)
29 result = struct.pack('>i', len(dumped)) + dumped
30 return result
31 21
32 def downloadbundle(repo, unknownbinhead): 22 def downloadbundle(repo, unknownbinhead):
33 index = repo.bundlestore.index 23 index = repo.bundlestore.index
34 store = repo.bundlestore.store 24 store = repo.bundlestore.store
35 bundleid = index.getbundle(hex(unknownbinhead)) 25 bundleid = index.getbundle(hex(unknownbinhead))