title: How to get the latest Perforce changelist in the depot for the current client spec
body: <p>I want to get the latest changelist in the depot for my current client spec. This would effectively be the change that would by synced to if I did a <code>p4 sync</code> in my workspace.</p>
  
  <p>I tried doing <code>p4 changes -s submitted -m1 -c [client-name]</code>, but that returns the most recent change that was submitted <em>via my client</em>.</p>
  
  <p>Doing <code>p4 changes -s submitted -m1 //depot/path/...</code> will work, but I don't want to have to query the client spec to figure out what the depot path is.  Plus if there were more than one mapping I wouldn't know how to make sense of that.</p>
  
  <p>It seems there must be a simple way to do this which I am missing.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I did have to query the client spec, but as pointed out in the accepted answer, I could use the client spec root as the file path and didn't need to look at the view mappings.</p>
  
  <p>Final solution using P4Python:</p>
  
  <pre><code># Get client
  clientspec = p4.fetch_client()
  root = clientspec["Root"]
  
  # Get latest changenum in client mapping
  changes = p4.run("changes", "-s", "submitted", "-m1", root + "/...")
  changenum = changes[0]['change']
  </code></pre>