It's all about the answers!

Ask a question

How to lock all files under a component in batch?


He Huang (31911) | asked Aug 14 '13, 5:12 a.m.
edited Oct 05 '17, 11:36 p.m. by David Lafreniere (4.8k7)

Now I can only lock one file in the RTC client by browse to the file and right click it, and select "lock" in the pop up menu. If I want to lock a bunch of files, it would be time consuming to lock file one by one. How can I lock all files under a component in batch?

Accepted answer


permanent link
David Lafreniere (4.8k7) | answered Oct 05 '17, 11:36 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 05 '17, 11:37 p.m.

Locking the Entire Stream or Component:

In RTC 6.0.2 we added a feature that lets you lock streams and components to prevent deliveries to the files in those streams or components. Stream and component locks work in a similar manner to file locks but apply to the entire stream or the entire component in a stream. When a stream or component is locked, any attempted deliveries by users who do not own the lock will fail with an appropriate error message. The user that holds the lock can still perform deliveries to the stream. A lock does not only prevent deliveries, it also prevents any operation that affects the files in the locked component or stream. For example, a component replace is also prevented.

See:
-New & Noteworthy Mention: https://jazz.net/downloads/rational-team-concert/releases/6.0.2?p=newsDetails#stream-locking
-Stream/Component Locking Demo Video: https://www.youtube.com/watch?v=b8QwzwUF2ZY
-SCM Command Line Client 'set lock' command: https://www.ibm.com/support/knowledgecenter/SSCP65_6.0.4/com.ibm.team.scm.doc/topics/set_lock.html

Prior to 6.0.2, one approach might be to add a deliver advisor in the process spec to restrict deliveries to particular streams. By protecting your stream by particular roles or users, you can effectively lock the stream down.
"http://jazz.net/library/article/215#protect_some" describes how to protect individual components in a stream, the same approach can be used to lock down the entire stream.


Using the CLI (Can also use a script)
You could use the scm commandline which allows you to specify multiple files... 'scm lock acquire -r <repo> -s <stream identifier> -R'
To get the list of files in a component you could use the following command... 'scm list remotefiles -r <repo> <stream identifier> <component identifier>'
To get an output that is consumable you could use the --json option.


Multi-selection in the Rich Clients (Eclipse/Visual Studio)
You can multi-select files in the Package Explorer or the Repository Files view and use the Lock context menu action action. There is no way to select a folder however, and have it recursively lock all child files.

Michael Valenta selected this answer as the correct answer

2 other answers



permanent link
Shashikant Padur (4.3k27) | answered Aug 14 '13, 7:38 a.m.
JAZZ DEVELOPER
edited Aug 14 '13, 7:38 a.m.
You could use the scm commandline which allows you to specify multiple files... 'scm lock acquire -r <repo> -s <stream identifier> -R'
To get the list of files in a component you could use the following command... 'scm list remotefiles -r <repo> <stream identifier> <component identifier>'
To get an output that is consumable you could use the --json option.

permanent link
Tim Mok (6.6k38) | answered Aug 14 '13, 11:33 a.m.
JAZZ DEVELOPER
The Eclipse client also allows you to select multiple files in the Package Explorer and execute the lock action on them. It may be a little tedious to select them all though as there isn't an option to lock a folder with a recursive option on its contents.

I believe there is a trick in the web UI where you can lock many files. From a stream, you start to delete a folder and it will lock it and all of its contents in that stream. They will remain locked until you follow through with the delete or cancel the action. You can also navigate away from the page and they will remain locked.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.