comparison mercurial-common/src/python/load-substates-command.py @ 706:c27e501ed0c3

use own command for hg subrepos
author eugene.petrenko@jetbrains.com
date Wed, 08 Jan 2014 18:32:42 +0100
parents
children 7d9e79de81e6
comparison
equal deleted inserted replaced
705:d113beb9e519 706:c27e501ed0c3
1 #!/usr/bin/env python
2 '''
3 load-substates-command
4
5 Copyright 2014 JetBrains <eugene.petrenko@jetbrains.com>
6 Mercurial extension commands for JetBrains' Mercurial integration
7 '''
8
9 import base64
10 from mercurial import util, node, scmutil, subrepo
11 from mercurial.i18n import _
12 from os import path, makedirs
13
14
15 def load_substates_command(ui, repo, outputFile, **opts):
16 """Tons of docs"""
17
18 ui.write("Searching for mappings...\n")
19
20 with open(outputFile, "w", 5 * 1024 * 1024) as result:
21 result.write("format: prefix commitID base64(.hgsub) base64(.hgsubstate) \n")
22 result.flush()
23
24 for r in repo.changelog:
25 ctx = repo[r]
26
27 if '.hgsubstate' in ctx and '.hgsub' in ctx:
28 commitId = node.hex(ctx.node())
29 result.write("$$@@@@ " + commitId + " " + base64.b64encode(ctx['.hgsub'].data()) + " " + base64.b64encode(ctx['.hgsubstate'].data()) + "\n")
30
31
32 ui.write("\n##Completed##\n")
33
34
35 #so here goes command registration and options
36 cmdtable = {
37 "load-substates-command": (load_substates_command, [ ], " [options] OUTPUT_FILE")
38 }
39
40 testedwith = '2.2.2'
41 buglink = "@jonnyzzz"
42