| 1 |
# monotone.py - monotone support for the convert extension |
| 2 |
# |
| 3 |
# Copyright 2008, 2009 Mikkel Fahnoe Jorgensen <[email protected]> and |
| 4 |
# others |
| 5 |
# |
| 6 |
# This software may be used and distributed according to the terms of the |
| 7 |
# GNU General Public License version 2 or any later version. |
| 8 |
|
| 9 |
from __future__scip-python python python-stdlib 3.11 __future__/__init__: import annotationsscip-python python python-stdlib 3.11 __future__/annotations.annotations. |
| 10 |
|
| 11 |
import osscip-python python python-stdlib 3.11 os/__init__: |
| 12 |
import rescip-python python python-stdlib 3.11 re/__init__: |
| 13 |
|
| 14 |
from mercurial.i18nscip-python python mercurial 7.2.2 `mercurial.i18n`/__init__: import _scip-python python mercurial 7.2.2 `mercurial.i18n`/_(). |
| 15 |
from mercurialscip-python python mercurial 7.2.2 mercurial/__init__: import ( |
| 16 |
errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:, |
| 17 |
pycompatscip-python python mercurial 7.2.2 `mercurial.pycompat`/__init__:, |
| 18 |
) |
| 19 |
from mercurial.utilsscip-python python mercurial 7.2.2 `mercurial.utils`/__init__: import dateutilscip-python python mercurial 7.2.2 `mercurial.utils.dateutil`/__init__: |
| 20 |
|
| 21 |
from . import commonscip-python python mercurial 7.2.2 common/__init__: |
| 22 |
|
| 23 |
|
| 24 |
class monotone_sourcescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#(commonscip-python python mercurial 7.2.2 common/__init__:.converter_sourcescip-python python mercurial 7.2.2 `hgext.convert.common`/converter_source#, commonscip-python python mercurial 7.2.2 common/__init__:.commandlinescip-python python mercurial 7.2.2 `hgext.convert.common`/commandline#): |
| 25 |
def __init__scip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self), uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(ui), repotypescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(repotype), pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(path)=None, revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(revs)=None): |
| 26 |
commonscip-python python mercurial 7.2.2 common/__init__:.converter_sourcescip-python python mercurial 7.2.2 `hgext.convert.common`/converter_source#.__init__scip-python python mercurial 7.2.2 `hgext.convert.common`/converter_source#__init__().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self), uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(ui), repotypescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(repotype), pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(path), revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(revs)) |
| 27 |
if revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(revs) and len(revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(revs)) > 1: |
| 28 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 29 |
_( |
| 30 |
b'monotone source does not support specifying ' |
| 31 |
b'multiple revs' |
| 32 |
) |
| 33 |
) |
| 34 |
commonscip-python python mercurial 7.2.2 common/__init__:.commandlinescip-python python mercurial 7.2.2 `hgext.convert.common`/commandline#.__init__scip-python python mercurial 7.2.2 `hgext.convert.common`/commandline#__init__().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self), uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(ui), b'mtn') |
| 35 |
|
| 36 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui. = uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(ui) |
| 37 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#path. = pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(path) |
| 38 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).automatestdioscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#automatestdio. = False |
| 39 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#revs. = revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(revs) |
| 40 |
|
| 41 |
norepo = commonscip-python python mercurial 7.2.2 common/__init__:.NoReposcip-python python mercurial 7.2.2 `hgext.convert.common`/NoRepo#( |
| 42 |
_(b"%s does not look like a monotone repository") % pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(path) |
| 43 |
) |
| 44 |
if not osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 genericpath/exists().(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..joinscip-python python python-stdlib 3.11 genericpath/exists().(pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(path), b'_MTN')): |
| 45 |
# Could be a monotone repository (SQLite db file) |
| 46 |
try: |
| 47 |
with openscip-python python python-stdlib 3.11 builtins/open().(pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(path), 'rb') as f: |
| 48 |
header = f.read(16) |
| 49 |
except OSErrorscip-python python python-stdlib 3.11 builtins/OSError#: |
| 50 |
header = b'' |
| 51 |
if header != b'SQLite format 3\x00': |
| 52 |
raise norepo |
| 53 |
|
| 54 |
# regular expressions for parsing monotone output |
| 55 |
space = br'\s*' |
| 56 |
name = br'\s+"((?:\\"|[^"])*)"\s*' |
| 57 |
value = name |
| 58 |
revision = br'\s+\[(\w+)\]\s*' |
| 59 |
lines = br'(?:.|\n)+' |
| 60 |
|
| 61 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).dir_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#dir_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().(space + b"dir" + name) |
| 62 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).file_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#file_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().( |
| 63 |
space + b"file" + name + b"content" + revision |
| 64 |
) |
| 65 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).add_file_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#add_file_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().( |
| 66 |
space + b"add_file" + name + b"content" + revision |
| 67 |
) |
| 68 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).patch_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#patch_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().( |
| 69 |
space + b"patch" + name + b"from" + revision + b"to" + revision |
| 70 |
) |
| 71 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).rename_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#rename_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().(space + b"rename" + name + b"to" + name) |
| 72 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).delete_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#delete_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().(space + b"delete" + name) |
| 73 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).tag_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#tag_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().(space + b"tag" + name + b"revision" + revision) |
| 74 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).cert_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#cert_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().( |
| 75 |
lines + space + b"name" + name + b"value" + value |
| 76 |
) |
| 77 |
|
| 78 |
attr = space + b"file" + lines + space + b"attr" + space |
| 79 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).attr_execute_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#attr_execute_re. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().( |
| 80 |
attr + b'"mtn:execute"' + space + b'"true"' |
| 81 |
) |
| 82 |
|
| 83 |
# cached data |
| 84 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).manifest_revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#manifest_rev. = None |
| 85 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).manifestscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#manifest. = None |
| 86 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).filesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#files. = None |
| 87 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#__init__().(self).dirsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#dirs. = None |
| 88 |
|
| •89 |
commonscip-python python mercurial 7.2.2 common/__init__:.checktoolscip-python python mercurial 7.2.2 `hgext.convert.common`/checktool().(b'mtn', abortscip-python python mercurial 7.2.2 `hgext.convert.common`/checktool().(abort)=False, debnamescip-python python mercurial 7.2.2 `hgext.convert.common`/checktool().(debname)=b'monotone') |
| 90 |
|
| 91 |
def mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(self), *argsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(args), **kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(kwargs)): |
| 92 |
if selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(self).automatestdioscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#automatestdio.: |
| 93 |
return selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(self).mtnrunstdioscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(*argsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(args), **kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(kwargs)) |
| 94 |
else: |
| 95 |
return selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(self).mtnrunsinglescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(*argsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(args), **kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(kwargs)) |
| 96 |
|
| 97 |
def mtnrunsinglescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(self), *argsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(args), **kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(kwargs)): |
| 98 |
kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(kwargs)['d'] = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(self).pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#path. |
| 99 |
return selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(self).run0scip-python python mercurial 7.2.2 `hgext.convert.common`/commandline#run0().(b'automate', *argsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(args), **kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(kwargs)) |
| 100 |
|
| 101 |
def mtnrunstdioscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(self), *argsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(args), **kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(kwargs)): |
| 102 |
# Prepare the command in automate stdio format |
| 103 |
kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(kwargs) = pycompatscip-python python mercurial 7.2.2 `mercurial.pycompat`/__init__:.byteskwargsscip-python python mercurial 7.2.2 `mercurial.pycompat`/byteskwargs().(kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(kwargs)) |
| 104 |
command = [] |
| 105 |
for k, v in kwargsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(kwargs).itemsscip-python python python-stdlib 3.11 builtins/dict#items().(): |
| 106 |
command.appendscip-python python python-stdlib 3.11 builtins/list#append().(b"%d:%s" % (len(k), k)) |
| 107 |
if v: |
| 108 |
command.appendscip-python python python-stdlib 3.11 builtins/list#append().(b"%d:%s" % (len(v), v)) |
| 109 |
if command: |
| 110 |
command.insertscip-python python python-stdlib 3.11 builtins/list#insert().(0, b'o') |
| 111 |
command.appendscip-python python python-stdlib 3.11 builtins/list#append().(b'e') |
| 112 |
|
| 113 |
command.appendscip-python python python-stdlib 3.11 builtins/list#append().(b'l') |
| 114 |
for arg in argsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(args): |
| 115 |
command.appendscip-python python python-stdlib 3.11 builtins/list#append().(b"%d:%s" % (len(arg), arg)) |
| 116 |
command.appendscip-python python python-stdlib 3.11 builtins/list#append().(b'e') |
| 117 |
command = b''.joinscip-python python python-stdlib 3.11 builtins/bytes#join().(command) |
| 118 |
|
| 119 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..debugscip-python python mercurial 7.2.2 `mercurial.ui`/ui#debug().(b"mtn: sending '%s'\n" % command) |
| 120 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(self).mtnwritefpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnwritefp..writescip-python python python-stdlib 3.11 typing/IO#write().(command) |
| 121 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(self).mtnwritefpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnwritefp..flushscip-python python python-stdlib 3.11 typing/IO#flush().() |
| 122 |
|
| 123 |
return selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunstdio().(self).mtnstdioreadcommandoutputscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(command) |
| 124 |
|
| 125 |
def mtnstdioreadpacketscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().(self)) -> tuplescip-python python python-stdlib 3.11 builtins/tuple#[bytesscip-python python python-stdlib 3.11 builtins/bytes#, bytesscip-python python python-stdlib 3.11 builtins/bytes#, intscip-python python python-stdlib 3.11 builtins/int#, bytesscip-python python python-stdlib 3.11 builtins/bytes#]: |
| 126 |
read = None |
| 127 |
commandnbr = b'' |
| 128 |
while read != b':': |
| 129 |
read = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..readscip-python python python-stdlib 3.11 typing/IO#read().(1) |
| 130 |
if not read: |
| 131 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#(_(b'bad mtn packet - no end of commandnbr')) |
| 132 |
commandnbr += read |
| 133 |
commandnbr = commandnbr[:-1] |
| 134 |
|
| 135 |
stream = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..readscip-python python python-stdlib 3.11 typing/IO#read().(1) |
| 136 |
if stream not in b'mewptl': |
| 137 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 138 |
_(b'bad mtn packet - bad stream type %s') % stream |
| 139 |
) |
| 140 |
|
| 141 |
read = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..readscip-python python python-stdlib 3.11 typing/IO#read().(1) |
| 142 |
if read != b':': |
| 143 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#(_(b'bad mtn packet - no divider before size')) |
| 144 |
|
| 145 |
read = None |
| 146 |
lengthstr = b'' |
| 147 |
while read != b':': |
| 148 |
read = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..readscip-python python python-stdlib 3.11 typing/IO#read().(1) |
| 149 |
if not read: |
| 150 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#(_(b'bad mtn packet - no end of packet size')) |
| 151 |
lengthstr += read |
| 152 |
try: |
| 153 |
length = intscip-python python python-stdlib 3.11 builtins/int#(lengthstr[:-1]) |
| 154 |
except TypeErrorscip-python python python-stdlib 3.11 builtins/TypeError#: |
| 155 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 156 |
_(b'bad mtn packet - bad packet size %s') % lengthstr |
| 157 |
) |
| 158 |
|
| 159 |
read = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..readscip-python python python-stdlib 3.11 typing/IO#read().(length) |
| 160 |
if len(read) != length: |
| 161 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 162 |
_( |
| 163 |
b"bad mtn packet - unable to read full packet " |
| 164 |
b"read %s of %d" |
| 165 |
) |
| 166 |
% (len(read), length) |
| 167 |
) |
| 168 |
|
| 169 |
return (commandnbr, stream, length, read) |
| 170 |
|
| 171 |
def mtnstdioreadcommandoutputscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(self), commandscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(command)) -> bytesscip-python python python-stdlib 3.11 builtins/bytes#: |
| 172 |
retval = [] |
| 173 |
while True: |
| 174 |
commandnbr, stream, length, output = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(self).mtnstdioreadpacketscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadpacket().() |
| 175 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..debugscip-python python mercurial 7.2.2 `mercurial.ui`/ui#debug().( |
| 176 |
b'mtn: read packet %s:%s:%d\n' % (commandnbr, stream, length) |
| 177 |
) |
| 178 |
|
| 179 |
if stream == b'l': |
| 180 |
# End of command |
| 181 |
if output != b'0': |
| 182 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 183 |
_(b"mtn command '%s' returned %s") % (commandscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(command), output) |
| 184 |
) |
| 185 |
break |
| 186 |
elif stream in b'ew': |
| 187 |
# Error, warning output |
| 188 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..warnscip-python python mercurial 7.2.2 `mercurial.ui`/ui#warn().(_(b'%s error:\n') % selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(self).commandscip-python python mercurial 7.2.2 `hgext.convert.common`/commandline#command.) |
| 189 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..warnscip-python python mercurial 7.2.2 `mercurial.ui`/ui#warn().(output) |
| 190 |
elif stream == b'p': |
| 191 |
# Progress messages |
| 192 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnstdioreadcommandoutput().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..debugscip-python python mercurial 7.2.2 `mercurial.ui`/ui#debug().(b'mtn: ' + output) |
| 193 |
elif stream == b'm': |
| 194 |
# Main stream - command output |
| 195 |
retval.appendscip-python python python-stdlib 3.11 builtins/list#append().(output) |
| 196 |
|
| 197 |
return b''.joinscip-python python python-stdlib 3.11 builtins/bytes#join().(retval) |
| 198 |
|
| 199 |
def mtnloadmanifestscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(rev)): |
| 200 |
if selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).manifest_revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#manifest_rev. == revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(rev): |
| 201 |
return |
| 202 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).manifestscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#manifest. = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(b"get_manifest_of", revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(rev)).splitscip-python python python-stdlib 3.11 builtins/bytes#split().(b"\n\n") |
| 203 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).manifest_revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#manifest_rev. = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(rev) |
| 204 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).filesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#files. = {} |
| 205 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).dirsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#dirs. = {} |
| 206 |
|
| 207 |
for e in selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).manifestscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#manifest.: |
| 208 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).file_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#file_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 209 |
if m: |
| 210 |
attr = b"" |
| 211 |
name = m.groupscip-python python python-stdlib 3.11 re/Match#group().(1) |
| 212 |
node = m.groupscip-python python python-stdlib 3.11 re/Match#group().(2) |
| 213 |
if selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).attr_execute_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#attr_execute_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e): |
| 214 |
attr += b"x" |
| 215 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).filesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#files.[name] = (node, attr) |
| 216 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).dir_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#dir_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 217 |
if m: |
| 218 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(self).dirsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#dirs.[m.groupscip-python python python-stdlib 3.11 re/Match#group().(1)] = True |
| 219 |
|
| 220 |
def mtnisfilescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(self), namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(name), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(rev)): |
| 221 |
# a non-file could be a directory or a deleted or renamed file |
| 222 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(self).mtnloadmanifestscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(rev)) |
| 223 |
return namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(name) in selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(self).filesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#files. |
| 224 |
|
| 225 |
def mtnisdirscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(self), namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(name), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(rev)): |
| 226 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(self).mtnloadmanifestscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(rev)) |
| 227 |
return namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(name) in selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(self).dirsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#dirs. |
| 228 |
|
| 229 |
def mtngetcertsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtngetcerts().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtngetcerts().(self), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtngetcerts().(rev)): |
| 230 |
certs = { |
| 231 |
b"author": b"<missing>", |
| 232 |
b"date": b"<missing>", |
| 233 |
b"changelog": b"<missing>", |
| 234 |
b"branch": b"<missing>", |
| 235 |
} |
| 236 |
certlist = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtngetcerts().(self).mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(b"certs", revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtngetcerts().(rev)) |
| 237 |
# mtn < 0.45: |
| 238 |
# key "[email protected]" |
| 239 |
# mtn >= 0.45: |
| 240 |
# key [ff58a7ffb771907c4ff68995eada1c4da068d328] |
| 241 |
certlist = rescip-python python python-stdlib 3.11 re/__init__:.splitscip-python python python-stdlib 3.11 re/split().(br'\n\n {6}key ["\[]', certlist) |
| 242 |
for e in certlist: |
| 243 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtngetcerts().(self).cert_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#cert_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 244 |
if m: |
| 245 |
name, value = m.groupsscip-python python python-stdlib 3.11 re/Match#groups().() |
| 246 |
assert value is not None # help pytype |
| 247 |
value = value.replacescip-python python python-stdlib 3.11 builtins/bytes#replace().(br'\"', b'"') |
| 248 |
value = value.replacescip-python python python-stdlib 3.11 builtins/bytes#replace().(br'\\', b'\\') |
| 249 |
certs[name] = value |
| 250 |
# Monotone may have subsecond dates: 2005-02-05T09:39:12.364306 |
| 251 |
# and all times are stored in UTC |
| 252 |
certs[b"date"] = certs[b"date"].splitscip-python python python-stdlib 3.11 builtins/bytes#split().(b'.')[0] + b" UTC" |
| 253 |
return certs |
| 254 |
|
| 255 |
# implement the converter_source interface: |
| 256 |
|
| 257 |
def getheadsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getheads().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getheads().(self)): |
| 258 |
if not selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getheads().(self).revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#revs.: |
| 259 |
return selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getheads().(self).mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(b"leaves").splitlinesscip-python python python-stdlib 3.11 builtins/bytes#splitlines().() |
| 260 |
else: |
| 261 |
return selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getheads().(self).revsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#revs. |
| 262 |
|
| 263 |
def getchangesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev), fullscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(full)): |
| 264 |
if fullscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(full): |
| 265 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 266 |
_(b"convert from monotone does not support --full") |
| 267 |
) |
| 268 |
revision = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(b"get_revision", revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev)).splitscip-python python python-stdlib 3.11 builtins/bytes#split().(b"\n\n") |
| 269 |
files = {} |
| 270 |
ignoremove = {} |
| 271 |
renameddirs = [] |
| 272 |
copies = {} |
| 273 |
for e in revision: |
| 274 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).add_file_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#add_file_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 275 |
if m: |
| 276 |
files[m.groupscip-python python python-stdlib 3.11 re/Match#group().(1)] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 277 |
ignoremove[m.groupscip-python python python-stdlib 3.11 re/Match#group().(1)] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 278 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).patch_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#patch_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 279 |
if m: |
| 280 |
files[m.groupscip-python python python-stdlib 3.11 re/Match#group().(1)] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 281 |
# Delete/rename is handled later when the convert engine |
| 282 |
# discovers an IOError exception from getfile, |
| 283 |
# but only if we add the "from" file to the list of changes. |
| 284 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).delete_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#delete_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 285 |
if m: |
| 286 |
files[m.groupscip-python python python-stdlib 3.11 re/Match#group().(1)] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 287 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).rename_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#rename_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 288 |
if m: |
| 289 |
toname = m.groupscip-python python python-stdlib 3.11 re/Match#group().(2) |
| 290 |
fromname = m.groupscip-python python python-stdlib 3.11 re/Match#group().(1) |
| 291 |
if selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).mtnisfilescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(toname, revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev)): |
| 292 |
ignoremove[toname] = 1 |
| 293 |
copies[toname] = fromname |
| 294 |
files[toname] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 295 |
files[fromname] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 296 |
elif selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).mtnisdirscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisdir().(toname, revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev)): |
| 297 |
renameddirs.appendscip-python python python-stdlib 3.11 builtins/list#append().((fromname, toname)) |
| 298 |
|
| 299 |
# Directory renames can be handled only once we have recorded |
| 300 |
# all new files |
| 301 |
for fromdir, todir in renameddirs: |
| 302 |
renamed = {} |
| 303 |
for tofile in selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).filesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#files.: |
| 304 |
if tofile in ignoremove: |
| 305 |
continue |
| 306 |
if tofile.startswith(todir + b'/'): |
| 307 |
renamed[tofile] = fromdir + tofile[len(todir) :] |
| 308 |
# Avoid chained moves like: |
| 309 |
# d1(/a) => d3/d1(/a) |
| 310 |
# d2 => d3 |
| 311 |
ignoremove[tofile] = 1 |
| 312 |
for tofile, fromfile in renamed.itemsscip-python python python-stdlib 3.11 builtins/dict#items().(): |
| 313 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..debugscip-python python mercurial 7.2.2 `mercurial.ui`/ui#debug().( |
| 314 |
b"copying file in renamed directory from '%s' to '%s'" |
| 315 |
% (fromfile, tofile), |
| 316 |
b'\n', |
| 317 |
) |
| 318 |
files[tofile] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 319 |
copies[tofile] = fromfile |
| 320 |
for fromfile in renamed.valuesscip-python python python-stdlib 3.11 builtins/dict#values().(): |
| 321 |
files[fromfile] = revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchanges().(rev) |
| 322 |
|
| 323 |
return (files.itemsscip-python python python-stdlib 3.11 builtins/dict#items().(), copies, setscip-python python python-stdlib 3.11 builtins/set#()) |
| 324 |
|
| 325 |
def getfilescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(self), namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(name), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(rev)): |
| 326 |
if not selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(self).mtnisfilescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnisfile().(namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(name), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(rev)): |
| 327 |
return None, None |
| 328 |
try: |
| 329 |
data = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(self).mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(b"get_file_of", namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(name), r=revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(rev)) |
| 330 |
except Exceptionscip-python python python-stdlib 3.11 builtins/Exception#: |
| 331 |
return None, None |
| 332 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(self).mtnloadmanifestscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnloadmanifest().(revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(rev)) |
| 333 |
node, attr = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(self).filesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#files..getscip-python python python-stdlib 3.11 builtins/dict#get().(namescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getfile().(name), (None, b"")) |
| 334 |
return data, attr |
| 335 |
|
| 336 |
def getcommitscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(self), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(rev)): |
| 337 |
extra = {} |
| 338 |
certs = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(self).mtngetcertsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtngetcerts().(revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(rev)) |
| 339 |
if certs.getscip-python python python-stdlib 3.11 builtins/dict#get().(b'suspend') == certs[b"branch"]: |
| 340 |
extra[b'close'] = b'1' |
| 341 |
dateformat = b"%Y-%m-%dT%H:%M:%S" |
| 342 |
return commonscip-python python mercurial 7.2.2 common/__init__:.commitscip-python python mercurial 7.2.2 `hgext.convert.common`/commit#( |
| 343 |
authorscip-python python mercurial 7.2.2 `hgext.convert.common`/commit#__init__().(author)=certs[b"author"], |
| 344 |
datescip-python python mercurial 7.2.2 `hgext.convert.common`/commit#__init__().(date)=dateutilscip-python python mercurial 7.2.2 `mercurial.utils.dateutil`/__init__:.datestrscip-python python mercurial 7.2.2 `mercurial.utils.dateutil`/datestr().(dateutilscip-python python mercurial 7.2.2 `mercurial.utils.dateutil`/__init__:.strdatescip-python python mercurial 7.2.2 `mercurial.utils.dateutil`/strdate().(certs[b"date"], dateformat)), |
| 345 |
descscip-python python mercurial 7.2.2 `hgext.convert.common`/commit#__init__().(desc)=certs[b"changelog"], |
| 346 |
revscip-python python mercurial 7.2.2 `hgext.convert.common`/commit#__init__().(rev)=revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(rev), |
| 347 |
parentsscip-python python mercurial 7.2.2 `hgext.convert.common`/commit#__init__().(parents)=selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(self).mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(b"parents", revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getcommit().(rev)).splitlinesscip-python python python-stdlib 3.11 builtins/bytes#splitlines().(), |
| 348 |
branchscip-python python mercurial 7.2.2 `hgext.convert.common`/commit#__init__().(branch)=certs[b"branch"], |
| 349 |
extrascip-python python mercurial 7.2.2 `hgext.convert.common`/commit#__init__().(extra)=extra, |
| 350 |
) |
| 351 |
|
| 352 |
def gettagsscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#gettags().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#gettags().(self)): |
| 353 |
tags = {} |
| 354 |
for e in selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#gettags().(self).mtnrunscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrun().(b"tags").splitscip-python python python-stdlib 3.11 builtins/bytes#split().(b"\n\n"): |
| 355 |
m = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#gettags().(self).tag_rescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#tag_re..matchscip-python python python-stdlib 3.11 re/Pattern#match().(e) |
| 356 |
if m: |
| 357 |
tags[m.groupscip-python python python-stdlib 3.11 re/Match#group().(1)] = m.groupscip-python python python-stdlib 3.11 re/Match#group().(2) |
| 358 |
return tags |
| 359 |
|
| 360 |
def getchangedfilesscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchangedfiles().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchangedfiles().(self), revscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchangedfiles().(rev), iscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#getchangedfiles().(i)): |
| 361 |
# This function is only needed to support --filemap |
| 362 |
# ... and we don't support that |
| 363 |
raise NotImplementedErrorscip-python python python-stdlib 3.11 builtins/NotImplementedError# |
| 364 |
|
| 365 |
def beforescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self)): |
| 366 |
# Check if we have a new enough version to use automate stdio |
| 367 |
try: |
| 368 |
versionstr = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).mtnrunsinglescip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnrunsingle().(b"interface_version") |
| 369 |
version = floatscip-python python python-stdlib 3.11 builtins/float#(versionstr) |
| 370 |
except Exceptionscip-python python python-stdlib 3.11 builtins/Exception#: |
| 371 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 372 |
_(b"unable to determine mtn automate interface version") |
| 373 |
) |
| 374 |
|
| 375 |
if version >= 12.0: |
| 376 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).automatestdioscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#automatestdio. = True |
| 377 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..debugscip-python python mercurial 7.2.2 `mercurial.ui`/ui#debug().( |
| 378 |
b"mtn automate version %f - using automate stdio\n" % version |
| 379 |
) |
| 380 |
|
| 381 |
# launch the long-running automate stdio process |
| 382 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).mtnwritefpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnwritefp., selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp. = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self)._run2scip-python python mercurial 7.2.2 `hgext.convert.common`/commandline#_run2().( |
| 383 |
b'automate', b'stdio', b'-d', selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).pathscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#path. |
| 384 |
) |
| 385 |
# read the headers |
| 386 |
read = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..readlinescip-python python python-stdlib 3.11 typing/IO#readline().() |
| 387 |
if read != b'format-version: 2\n': |
| 388 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 389 |
_(b'mtn automate stdio header unexpected: %s') % read |
| 390 |
) |
| 391 |
while read != b'\n': |
| 392 |
read = selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..readlinescip-python python python-stdlib 3.11 typing/IO#readline().() |
| 393 |
if not read: |
| 394 |
raise errorscip-python python mercurial 7.2.2 `mercurial.error`/__init__:.Abortscip-python python mercurial 7.2.2 `mercurial.error`/Abort#( |
| 395 |
_( |
| 396 |
b"failed to reach end of mtn automate " |
| 397 |
b"stdio headers" |
| 398 |
) |
| 399 |
) |
| 400 |
else: |
| 401 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#before().(self).uiscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#ui..debugscip-python python mercurial 7.2.2 `mercurial.ui`/ui#debug().( |
| 402 |
b"mtn automate version %f - not using automate stdio " |
| 403 |
b"(automate >= 12.0 - mtn >= 0.46 is needed)\n" % version |
| 404 |
) |
| 405 |
|
| 406 |
def afterscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#after().(selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#after().(self)): |
| 407 |
if selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#after().(self).automatestdioscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#automatestdio.: |
| 408 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#after().(self).mtnwritefpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnwritefp..closescip-python python python-stdlib 3.11 typing/IO#close().() |
| 409 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#after().(self).mtnwritefpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnwritefp. = None |
| 410 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#after().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp..closescip-python python python-stdlib 3.11 typing/IO#close().() |
| 411 |
selfscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#after().(self).mtnreadfpscip-python python mercurial 7.2.2 `hgext.convert.monotone`/monotone_source#mtnreadfp. = None |