Skip to content

Commit 1997e91

Browse files
migueltorrojagitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b596b3b commit 1997e91

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

git-p4.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,15 @@ def p4_move(src, dest):
313313
p4_system(["move", "-k", wildcard_encode(src), wildcard_encode(dest)])
314314

315315
def p4_last_change():
316-
results = p4CmdList(["changes", "-m", "1"])
316+
results = p4CmdList(["changes", "-m", "1"], skip_info=True)
317317
return int(results[0]['change'])
318318

319319
def p4_describe(change):
320320
"""Make sure it returns a valid result by checking for
321321
the presence of field "time". Return a dict of the
322322
results."""
323323

324-
ds = p4CmdList(["describe", "-s", str(change)])
324+
ds = p4CmdList(["describe", "-s", str(change)], skip_info=True)
325325
if len(ds) != 1:
326326
die("p4 describe -s %d did not return 1 result: %s" % (change, str(ds)))
327327

@@ -509,7 +509,7 @@ def isModeExec(mode):
509509
def isModeExecChanged(src_mode, dst_mode):
510510
return isModeExec(src_mode) != isModeExec(dst_mode)
511511

512-
def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
512+
def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False):
513513

514514
if isinstance(cmd,basestring):
515515
cmd = "-G " + cmd
@@ -545,6 +545,9 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
545545
try:
546546
while True:
547547
entry = marshal.load(p4.stdout)
548+
if skip_info:
549+
if 'code' in entry and entry['code'] == 'info':
550+
continue
548551
if cb is not None:
549552
cb(entry)
550553
else:

t/t9831-git-p4-triggers.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test_expect_success 'init depot' '
2020
)
2121
'
2222

23-
test_expect_failure 'clone with extra info lines from verbose p4 trigger' '
23+
test_expect_success 'clone with extra info lines from verbose p4 trigger' '
2424
test_when_finished cleanup_git &&
2525
(
2626
p4 triggers -i <<-EOF
@@ -38,7 +38,7 @@ test_expect_failure 'clone with extra info lines from verbose p4 trigger' '
3838
)
3939
'
4040

41-
test_expect_failure 'import with extra info lines from verbose p4 trigger' '
41+
test_expect_success 'import with extra info lines from verbose p4 trigger' '
4242
test_when_finished cleanup_git &&
4343
(
4444
cd "$cli" &&

0 commit comments

Comments
 (0)