зеркало из https://github.com/microsoft/git.git
git-p4: filter for {'code':'info'} in p4CmdList
The function p4CmdList accepts a new argument: skip_info. When set to True it ignores any 'code':'info' entry (skip_info=False by default). That allows us to fix some of the tests in t9831-git-p4-triggers.sh known to be broken with verobse p4 triggers Signed-off-by: Miguel Torroja <miguel.torroja@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
b596b3b920
Коммит
1997e91f4b
|
@ -313,7 +313,7 @@ def p4_move(src, dest):
|
||||||
p4_system(["move", "-k", wildcard_encode(src), wildcard_encode(dest)])
|
p4_system(["move", "-k", wildcard_encode(src), wildcard_encode(dest)])
|
||||||
|
|
||||||
def p4_last_change():
|
def p4_last_change():
|
||||||
results = p4CmdList(["changes", "-m", "1"])
|
results = p4CmdList(["changes", "-m", "1"], skip_info=True)
|
||||||
return int(results[0]['change'])
|
return int(results[0]['change'])
|
||||||
|
|
||||||
def p4_describe(change):
|
def p4_describe(change):
|
||||||
|
@ -321,7 +321,7 @@ def p4_describe(change):
|
||||||
the presence of field "time". Return a dict of the
|
the presence of field "time". Return a dict of the
|
||||||
results."""
|
results."""
|
||||||
|
|
||||||
ds = p4CmdList(["describe", "-s", str(change)])
|
ds = p4CmdList(["describe", "-s", str(change)], skip_info=True)
|
||||||
if len(ds) != 1:
|
if len(ds) != 1:
|
||||||
die("p4 describe -s %d did not return 1 result: %s" % (change, str(ds)))
|
die("p4 describe -s %d did not return 1 result: %s" % (change, str(ds)))
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ def isModeExec(mode):
|
||||||
def isModeExecChanged(src_mode, dst_mode):
|
def isModeExecChanged(src_mode, dst_mode):
|
||||||
return isModeExec(src_mode) != isModeExec(dst_mode)
|
return isModeExec(src_mode) != isModeExec(dst_mode)
|
||||||
|
|
||||||
def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
|
def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False):
|
||||||
|
|
||||||
if isinstance(cmd,basestring):
|
if isinstance(cmd,basestring):
|
||||||
cmd = "-G " + cmd
|
cmd = "-G " + cmd
|
||||||
|
@ -545,6 +545,9 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
entry = marshal.load(p4.stdout)
|
entry = marshal.load(p4.stdout)
|
||||||
|
if skip_info:
|
||||||
|
if 'code' in entry and entry['code'] == 'info':
|
||||||
|
continue
|
||||||
if cb is not None:
|
if cb is not None:
|
||||||
cb(entry)
|
cb(entry)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -20,7 +20,7 @@ test_expect_success 'init depot' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'clone with extra info lines from verbose p4 trigger' '
|
test_expect_success 'clone with extra info lines from verbose p4 trigger' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
(
|
(
|
||||||
p4 triggers -i <<-EOF
|
p4 triggers -i <<-EOF
|
||||||
|
@ -38,7 +38,7 @@ test_expect_failure 'clone with extra info lines from verbose p4 trigger' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'import with extra info lines from verbose p4 trigger' '
|
test_expect_success 'import with extra info lines from verbose p4 trigger' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
(
|
(
|
||||||
cd "$cli" &&
|
cd "$cli" &&
|
||||||
|
|
Загрузка…
Ссылка в новой задаче