Wolfram Posted March 28, 2022 Report Share Posted March 28, 2022 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 More sharing options...
Wolfram Posted April 6, 2022 Author Report Share Posted April 6, 2022 Any ideas for this? It would really help for automation processes. Link to comment Share on other sites More sharing options...
ollieblanks Posted April 7, 2022 Report Share Posted April 7, 2022 You could use something similar to this to get the highest number changeset number. cm find changeset "where date > '3 months ago'" --format={changesetid} --nototal | tail -1 Hope this helps! 1 Link to comment Share on other sites More sharing options...
Wolfram Posted April 7, 2022 Author Report Share Posted April 7, 2022 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 More sharing options...
Wolfram Posted April 8, 2022 Author Report Share Posted April 8, 2022 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. 1 Link to comment Share on other sites More sharing options...
ollieblanks Posted April 12, 2022 Report Share Posted April 12, 2022 Ah yes the order by and limit clauses. Great solution! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now