Jump to content

command line browsing of repository


tsamstag

Recommended Posts

I'm working on a script that uses the command line Plastic client. Part of this script will require me to examine the state of the changes of a branch, potentially a branch that is not the current branch. I can easily see the revisions made on a branch, but I'd like to see if a revised file still exists on a branch. For instance, if I have:

/a/b/test.txt

and I modify test.txt, but then delete the directory a, I'd like to be able to query Plastic to find if test.txt still exists. It technically hasn't been removed, since it was its parent that was removed. Additionally, this would be even more helpful if this query could be performed while on another branch without changing branches.

I figured it could be done by cm ls if I could specify a branch or changeset to use as a view, but that doesn't seem to be possible. I also thought that it could be done with cm ls if I temporarily modify the selector to view the repository at a given branch, but I couldn't get that to work.

I tried to gather the information I needed from the database with cm q, but it got very complicated quickly, and would potentially rely on undocumented behavior that could change.

Is it possible to do this? What are my options?

Link to comment
Share on other sites

tsamstag,

when you removed the parent directory, you removed the directory that loads the file test.txt in a specific branch/changeset.

maybe this could help.

cm find removed where branch='br:/main/xyz'

cm find revision where item = '../a/b/test.txt' and branch='br:/main/xyz'

Cheers,

Miller

Link to comment
Share on other sites

I'm not sure how your examples help with my specific case, but I suppose I should give more details. Suppose you have the same file /a/b/test.txt where your workspace is at c:\plastic\test, giving you a file at c:\plastic\test\a\b\test.txt. If I edit that file in my branch br:/main/mytest and checkin, I can get that info by doing:

cm find revs where branch='/main/mytest'

If I then delete the a directory, and check in, that same find revs shows me the change to c:\plastic\test\a\b\test.txt and to c:\plastic\test\, as expected.

Now if I want to generate a report describing the state of that branch, ideally, I wouldn't include the diff of test.txt, because the file has been deleted, making its changes irrelevant. Is there any easy way to ask Plastic if the file (given by itemid) is still in the view of the repository on a given branch?

In the GUI, I can now find that out by using the helpful "Browse repository on this branch" feature that was added recently. Is a similar method available through the command line?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...