Jump to content

update to latest changeset of ANY branch using command line?


Wolfram

Recommended Posts

I am looking for a method to update a workspace to the latest changeset vla CLI - regardless of on which branch I am, or on which branch that latest changeset is. Just the highest cs number (or the cs with the youngest timestamp).

I have tried

cm update --last --forced --verbose <wk_name>

and similar, but they are apparently all restricted to the current branch I am on. I also haven't found a combination of "cm status" parameters to figure out that cs number, as it also seems to refer to the current branch only.

 

The reason behind this, I'd like to have an automatically maintained (=kept up-to-date) overview of the current state of all Assets of ALL repositories (for example, to quickly check which repository is currently using which Asset).

If this is not possible directly, is there a method to figure out on which branch the latest cs is? Then I would be able to run a command to switch to that particular branch, and then do a regular update.

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
  • Wolfram changed the title to update to latest changeset of ANY branch using command line?

Ah, thanks for the answer!

I did discover the "find changeset" command, but wasn't aware of the additional formatting options - until now I was using complicated string processing to get to the correct line from its output, but these options are quite helpful!

Also, it seems with newer server versions, there are now also additional parameters for "find", such as "limit <x>" and "order by changeset asc", which should help to get rid of that additional "tail pipe" (hehe) - which is helpful, as the "tail" command is not available in a normal Windoze CMD shell. And as we're mainly working with Unity Windows, we need to make C# Process()/system calls to "cm" that windows actually understands. Or is there a better way to get info from Plastic and/or "cm" from within Unity? (except the UnityEditor.VersionControl classes (which are essentially undocumented, and I couldn't get them to work with Plastic), and except the great REST-API via "cm api" (but this would require our users to always launch "cm api" first).

(also, our Plastic server is still on an old version that doesn't support the "limit" parameter, will report back after we upgraded it.)

Link to comment
Share on other sites

Indeed, the shell pipe can be avoided, and the command can be abbreviated to: 

cm find "changeset order by changesetid desc limit 1" --format={changesetid} --nototal

, which makes it even independent of when the last checkin was made.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...