Topic
  • 7 replies
  • Latest Post - ‏2013-06-01T08:24:36Z by Dave-Robinson
Tuan_Vo
Tuan_Vo
4 Posts

Pinned topic Can we transfers mastership of all objects in a directory?

‏2013-05-03T08:55:25Z |

I know that we can transfer mastership of an object like this example:

At replica sanfran_hub, transfer mastership of element list.c to the sydney replica.


multitool chmaster sydney list.c@@/main
Changed mastership of ″list.c″ to ″sydney″

However, I do not know how to transfer mastership of all files in a directory. Example:


sydney/
 list1.c
 list2.c
 list3.c
 ...

If I run


multitool chmaster 
sydney 
sydney@@/main

It only change mastership of the directory "sydney", not all the files inside it.

 

  • GKellner
    GKellner
    259 Posts
    ACCEPTED ANSWER

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-05-03T08:59:41Z  

    A cleartool find . -exec "multitool chmaster sydney_replica %CLEARCASE_PN%" should do the job.

  • GKellner
    GKellner
    259 Posts

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-05-03T08:59:41Z  

    A cleartool find . -exec "multitool chmaster sydney_replica %CLEARCASE_PN%" should do the job.

  • Tuan_Vo
    Tuan_Vo
    4 Posts

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-05-03T10:11:45Z  
    • GKellner
    • ‏2013-05-03T08:59:41Z

    A cleartool find . -exec "multitool chmaster sydney_replica %CLEARCASE_PN%" should do the job.

    Thank you very much!

    Addition, is there any way that we can get the string after the @@

    Instead of run (Linux OS)

    cleartool find . -exec 'multitool chmaster sydney "$CLEARCASE_PN@@/main"'

    Could we use variable for @@/main

  • Dave-Robinson
    Dave-Robinson
    116 Posts

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-05-08T09:38:01Z  
    • Tuan_Vo
    • ‏2013-05-03T10:11:45Z

    Thank you very much!

    Addition, is there any way that we can get the string after the @@

    Instead of run (Linux OS)

    cleartool find . -exec 'multitool chmaster sydney "$CLEARCASE_PN@@/main"'

    Could we use variable for @@/main

    http://publib.boulder.ibm.com/infocenter/cchelp/v8r0m0/topic/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_find.htm

    When using the -exec or -ok command invocation, ... use one or more of these environment variables to reference the selected object:

     

    With the command provided by GKellner "the selected object" shall be the element,

      CLEARCASE_ID_STR shall be null

      and CLEARCASE_XPN  shall be CLEARCASE_PN with "@@" appended

    Is it the element you wish to chmaster or the current branch of the file?

    cleartool find . -branch "brtype(XXXX)" -exec 'multitool chmaster sydney "$CLEARCASE_XPN@@/main"'

    maybe more what you are looking for.

    Check the "find" reference page linked above

    CLEARCASE_PN
    Path name of selected element or VOB symbolic link
    CLEARCASE_XN_SFX
    Extended naming symbol (default: @@)
    CLEARCASE_ID_STR
    Branch path name of a branch object (\main\rel2_bugfix); version ID of a version object (\main\rel2_bugfix\4); null for an element
    CLEARCASE_XPN
    Full version-extended path name of the selected branch or version (concatenation of the three preceding variables)
  • Tuan_Vo
    Tuan_Vo
    4 Posts

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-05-09T08:10:19Z  

    http://publib.boulder.ibm.com/infocenter/cchelp/v8r0m0/topic/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_find.htm

    When using the -exec or -ok command invocation, ... use one or more of these environment variables to reference the selected object:

     

    With the command provided by GKellner "the selected object" shall be the element,

      CLEARCASE_ID_STR shall be null

      and CLEARCASE_XPN  shall be CLEARCASE_PN with "@@" appended

    Is it the element you wish to chmaster or the current branch of the file?

    cleartool find . -branch "brtype(XXXX)" -exec 'multitool chmaster sydney "$CLEARCASE_XPN@@/main"'

    maybe more what you are looking for.

    Check the "find" reference page linked above

    CLEARCASE_PN
    Path name of selected element or VOB symbolic link
    CLEARCASE_XN_SFX
    Extended naming symbol (default: @@)
    CLEARCASE_ID_STR
    Branch path name of a branch object (\main\rel2_bugfix); version ID of a version object (\main\rel2_bugfix\4); null for an element
    CLEARCASE_XPN
    Full version-extended path name of the selected branch or version (concatenation of the three preceding variables)

    I have some problem with branch path, like

    list1.c@@/main/dev2

    and

    list2.c@@/main/dev1/dev2

    They are not same branch path. I want to get the branch path by variable, not hardcore like @@/main . I looking for a variable which get the element branch path (@@/main/dev2 or @@/main/dev1/dev2), example $CLEARCASE_BRANCH_PATH

    cleartool find . -exec 'multitool chmaster sydney "$CLEARCASE_PN@@$CLEARCASE_BRANCH_PATH"'

  • Dave-Robinson
    Dave-Robinson
    116 Posts

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-05-13T04:46:45Z  
    • Tuan_Vo
    • ‏2013-05-09T08:10:19Z

    I have some problem with branch path, like

    list1.c@@/main/dev2

    and

    list2.c@@/main/dev1/dev2

    They are not same branch path. I want to get the branch path by variable, not hardcore like @@/main . I looking for a variable which get the element branch path (@@/main/dev2 or @@/main/dev1/dev2), example $CLEARCASE_BRANCH_PATH

    cleartool find . -exec 'multitool chmaster sydney "$CLEARCASE_PN@@$CLEARCASE_BRANCH_PATH"'

    CLEARCASE_ID_STR

  • Tuan_Vo
    Tuan_Vo
    4 Posts

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-06-01T03:01:39Z  

    CLEARCASE_ID_STR

    The variable  CLEARCASE_ID_STR cannot help :(

    cleartool find . -exec 'multitool chmaster sydney "$CLEARCASE_PN@@$CLEARCASE_ID_STR"'

  • Dave-Robinson
    Dave-Robinson
    116 Posts

    Re: Can we transfers mastership of all objects in a directory?

    ‏2013-06-01T08:24:36Z  
    • Tuan_Vo
    • ‏2013-06-01T03:01:39Z

    The variable  CLEARCASE_ID_STR cannot help :(

    cleartool find . -exec 'multitool chmaster sydney "$CLEARCASE_PN@@$CLEARCASE_ID_STR"'

    cleartool find . -branch "brtype(dev2)" -exec 'multitool chmaster sydney "$CLEARCASE_PN@@$CLEARCASE_ID_STR"'

    OR

    cleartool find . -branch "brtype(dev2)" -exec 'multitool chmaster sydney "$CLEARCASE_XPN"'

    When you omit "-element" and "-branch" and "-version" the the objects returned by "find", identified by the XPN and ID_STR  variables are elements. If you want "find" to identify branches for you, then you MUST specify -branch and NOT specify -version.

    Note that the "brtype()" specifies the name of the brtype object, not the full branch path. CLEARCASE_ID_STR will resolve the to the full branch path of the branch of that type for each element that has one - and shall not take any action for elements that do not have a branch of that type.

    the command you gave would change mastership of elements, not branches, as CLEARCASE_ID_STR is null for elements

     

    the answer provided by GKellner also fails, since you cannot chmaster versions, and CLEARCASE_PN resolves to the version currently selected by the view. (The idea of using "find" was appropriate but the idea needed some further development.)

    ----------------------------------

    R:\replicant>cleartool find . -exec "cleartool chmaster -nc rep1 %CLEARCASE_PN%"
    cleartool: Error: You must use the extended naming suffix (by default, @@)
               to change mastership on an element.
    cleartool: Error: You must use the extended naming suffix (by default, @@)
               to change mastership on an element.

    R:\replicant>

    ----------------------------------

    compare

    ----------------------------------

    R:\replicant>cleartool find . -exec "cleartool chmaster -nc rep1 %CLEARCASE_XPN%"
    Changed mastership of directory element "\replicant\.@@" to "rep1".
    Changed mastership of directory element "\replicant\lost+found@@" to "rep1".

    R:\replicant>cleartool find . -branch "brtype(main)" -exec "cleartool chmaster -nc rep1 %CLEARCASE_XPN%"
    Changed mastership of branch "\replicant\.@@\main" to "rep1".
    Changed mastership of branch "\replicant\lost+found@@\main" to "rep1".


    ----------------------------------