Topic
5 replies Latest Post - ‏2012-12-07T18:59:35Z by SystemAdmin
JirongHu
JirongHu
678 Posts
ACCEPTED ANSWER

Pinned topic How to skip check-in pre-op trigger if the file has no change?

‏2012-12-04T01:17:52Z |
Hi All

I have a check-in pre-op trigger to execute a call to backend systems. I found the call is executed even the file has no change (identical so check-in will fail). Is there a way I can skip this trigger if the file is identical (has no change)?

Thanks
Jirong
Updated on 2012-12-07T18:59:35Z at 2012-12-07T18:59:35Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    47293 Posts
    ACCEPTED ANSWER

    Re: How to skip check-in pre-op trigger if the file has no change?

    ‏2012-12-04T08:15:34Z  in response to JirongHu
    JirongHu wrote:
    > Is there a way I can skip this trigger if the file is identical (has no change)?

    Sure:
    ct lock -obs trtype:xyz
    
    and use a wrapper instead to implement the functionality.

    It is one of the many drawbacks of triggers that you cannot really avoid running them (except using
    -nusers
    
    but this doesn't apply to your case)--you may at most have them return fast.
    But this implies that they are found, and launched.
    For instance, this is defeated on Windows if you run in a Cygwin shell!

    'The only good trigger is a dead trigger' --Gl Custer

    Marc
    Updated on 2014-03-26T13:44:49Z at 2014-03-26T13:44:49Z by iron-man
    • SystemAdmin
      SystemAdmin
      47293 Posts
      ACCEPTED ANSWER

      Re: How to skip check-in pre-op trigger if the file has no change?

      ‏2012-12-06T16:57:28Z  in response to SystemAdmin
      Hi Jirong,

      You can either
      1) check for identical in your pre-op trigger and if so then skip the call to the backend system
      or
      2) perhaps only peform the backend call in a post-op checkin trigger (this depends on the the back end call is and the policy you are tying to implement.)

      Hope this helps...

      -Charles

      Try ClearTrigger, ClearReplica and ClearWeb at http://www.abs-consulting.com

      A Better Solution, Inc.

      Charles Clarke III
      Rational Tools Consultant
      A Better Solution, Inc.
      4303 Cedar Lake Cove
      Conley, Ga. 30288

      Email: charles@abs-consulting.com
      http://www.abs-consulting.com
      • JirongHu
        JirongHu
        678 Posts
        ACCEPTED ANSWER

        Re: How to skip check-in pre-op trigger if the file has no change?

        ‏2012-12-06T17:01:08Z  in response to SystemAdmin
        1) check for identical in your pre-op trigger and if so then skip the call to the backend system

        Hi Charles

        Can you tell me how to check for identical in the trigger?

        Thanks
        Jirong
        • SystemAdmin
          SystemAdmin
          47293 Posts
          ACCEPTED ANSWER

          Re: How to skip check-in pre-op trigger if the file has no change?

          ‏2012-12-06T17:24:16Z  in response to JirongHu
          Jirong,

          You would perform a "cleartool diff", "cleardiff" or you favorite cmd line diff tool... on the
          element and the predecessor of the element..

          Hope this helps...

          -Charles

          Try ClearTrigger, ClearReplica and ClearWeb at http://www.abs-consulting.com

          A Better Solution, Inc.


          Charles Clarke III
          Rational Tools Consultant
          A Better Solution, Inc.
          4303 Cedar Lake Cove
          Conley, Ga. 30288

          Email: charles@abs-consulting.com
          http://www.abs-consulting.com
          • SystemAdmin
            SystemAdmin
            47293 Posts
            ACCEPTED ANSWER

            Re: How to skip check-in pre-op trigger if the file has no change?

            ‏2012-12-07T18:59:35Z  in response to SystemAdmin
            abs wrote:
            > You would perform a "cleartool diff", "cleardiff" or you favorite cmd line diff tool...
            > on the element and the predecessor of the element..

            Only, do it in a wrapper around the checkin operation, not in a trigger!
            In fact, this is what David Boyce's ClearCase::Wrapper and my own ClearCase::Wrapper::MGi offer with:
            ct ci -revert
            


            Marc
            Updated on 2014-03-26T13:44:41Z at 2014-03-26T13:44:41Z by iron-man