Topic
  • 5 replies
  • Latest Post - ‏2012-12-07T18:59:35Z by SystemAdmin
JirongHu
JirongHu
683 Posts

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

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

    ‏2012-12-04T08:15:34Z  
    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

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

    ‏2012-12-06T16:57:28Z  
    JirongHu wrote:
    > Is there a way I can skip this trigger if the file is identical (has no change)?

    Sure: <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">ct lock -obs trtype:xyz </pre> 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 <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">-nusers </pre> 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
    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
    683 Posts

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

    ‏2012-12-06T17:01:08Z  
    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
    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

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

    ‏2012-12-06T17:24:16Z  
    • JirongHu
    • ‏2012-12-06T17:01:08Z
    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
    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

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

    ‏2012-12-07T18:59:35Z  
    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
    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