Saturday, 15 May 2010

How to get the latest Perforce changelist in the depot for the current client spec -



How to get the latest Perforce changelist in the depot for the current client spec -

i want latest changelist in depot current client spec. alter synced if did p4 sync in workspace.

i tried doing p4 changes -s submitted -m1 -c [client-name], returns recent alter submitted via client.

doing p4 changes -s submitted -m1 //depot/path/... work, don't want have query client spec figure out depot path is. plus if there more 1 mapping wouldn't know how create sense of that.

it seems there must simple way missing.

edit

i did have query client spec, pointed out in accepted answer, utilize client spec root file path , didn't need @ view mappings.

final solution using p4python:

# client clientspec = p4.fetch_client() root = clientspec["root"] # latest changenum in client mapping changes = p4.run("changes", "-s", "submitted", "-m1", root + "/...") changenum = changes[0]['change']

i think you're going have query client spec find local root. if don't need worry altroots, be:

p4 changes -s submitted -m 1 "$(p4 client -o | grep "^root:" | cutting -f 2)/..."

in bash. using local client root instead of depot path avoids problem multiple mappings.

perforce

No comments:

Post a Comment