Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
# convcmd - convert extension commands definition | # convcmd - convert extension commands definition | ||||
# | # | ||||
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | ||||
# | # | ||||
# This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
# GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
from __future__ import absolute_import | from __future__ import absolute_import | ||||
import collections | import collections | ||||
import os | import os | ||||
import shlex | |||||
import shutil | import shutil | ||||
from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
from mercurial import ( | from mercurial import ( | ||||
encoding, | encoding, | ||||
error, | error, | ||||
hg, | hg, | ||||
pycompat, | pycompat, | ||||
try: | try: | ||||
fp = open(path, 'rb') | fp = open(path, 'rb') | ||||
for i, line in enumerate(util.iterfile(fp)): | for i, line in enumerate(util.iterfile(fp)): | ||||
line = line.splitlines()[0].rstrip() | line = line.splitlines()[0].rstrip() | ||||
if not line: | if not line: | ||||
# Ignore blank lines | # Ignore blank lines | ||||
continue | continue | ||||
# split line | # split line | ||||
lex = shlex.shlex(line, posix=True) | lex = common.shlexer(data=line, whitespace=',') | ||||
lex.whitespace_split = True | |||||
lex.whitespace += ',' | |||||
line = list(lex) | line = list(lex) | ||||
# check number of parents | # check number of parents | ||||
if not (2 <= len(line) <= 3): | if not (2 <= len(line) <= 3): | ||||
raise error.Abort(_('syntax error in %s(%d): child parent1' | raise error.Abort(_('syntax error in %s(%d): child parent1' | ||||
'[,parent2] expected') % (path, i + 1)) | '[,parent2] expected') % (path, i + 1)) | ||||
for part in line: | for part in line: | ||||
self.source.checkrevformat(part) | self.source.checkrevformat(part) | ||||
child, p1, p2 = line[0], line[1:2], line[2:] | child, p1, p2 = line[0], line[1:2], line[2:] |