• 
      

    Fix diff path generation when running inside a setview.

    Review Request #15148 — Created July 3, 2026 and updated

    Information

    RBTools
    master

    Reviewers

    On linux, users can enter a ClearCase view either through the view root
    (/view/<tag>/...) or with cleartool setview. In the setview case,
    cleartool pwv -root returns an empty string, which we stored as the
    root path of the view.

    Every path in the generated diff (the diff headers, the DiffX
    "path" fields, and the versionvault metadata) is computed with
    os.path.relpath() against that root path. With an empty root path,
    relpath() resolves against the current working directory instead,
    producing paths like "../gui2/bin/clearcase/Xmakefile" that depend
    entirely on where the user happened to run rbt.

    The server can never resolve these, resulting in file-not-found errors
    during diff validation. The same change would post fine for a user who
    entered the view through /view/<tag>, which made the failures look
    sporadic.

    We now detect the empty result and use the filesystem root as the view
    root. In a setview, VOBs appear directly under /, so this makes all
    generated paths view-relative again, matching what a /view-based
    workflow produces.

    • Added a unit test for get_local_path() in a setview context.
    • Ran unit tests.
    Summary ID
    Fix diff path generation when running inside a setview.
    On linux, users can enter a ClearCase view either through the view root (/view/<tag>/...) or with `cleartool setview`. In the setview case, `cleartool pwv -root` returns an empty string, which we stored as the root path of the view. Every path in the generated diff (the diff headers, the DiffX "path" fields, and the versionvault metadata) is computed with `os.path.relpath()` against that root path. With an empty root path, `relpath()` resolves against the current working directory instead, producing paths like "../gui2/bin/clearcase/Xmakefile" that depend entirely on where the user happened to run rbt. The server can never resolve these, resulting in file-not-found errors during diff validation. The same change would post fine for a user who entered the view through /view/<tag>, which made the failures look sporadic. We now detect the empty result and use the filesystem root as the view root. In a setview, VOBs appear directly under /, so this makes all generated paths view-relative again, matching what a /view-based workflow produces. Testing Done: - Added a unit test for get_local_path() in a setview context. - Ran unit tests.
    kvyqumtmwmvoootxkpvzskpmtnlkopxs
    Description From Last Updated

    The code was already this way, but let's avoid setting root_path until we have a validated, normalized value. This new …

    chipx86 chipx86
    chipx86
    1. 
        
    2. rbtools/clients/clearcase.py (Diff revision 1)
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
      Show all issues

      The code was already this way, but let's avoid setting root_path until we have a validated, normalized value.

      This new block could also just be folded into the initial set as an or os.sep.

    3. 
        
    david
    Review request changed
    Commits:
    Summary ID
    Fix diff path generation when running inside a setview.
    On linux, users can enter a ClearCase view either through the view root (/view/<tag>/...) or with `cleartool setview`. In the setview case, `cleartool pwv -root` returns an empty string, which we stored as the root path of the view. Every path in the generated diff (the diff headers, the DiffX "path" fields, and the versionvault metadata) is computed with `os.path.relpath()` against that root path. With an empty root path, `relpath()` resolves against the current working directory instead, producing paths like "../gui2/bin/clearcase/Xmakefile" that depend entirely on where the user happened to run rbt. The server can never resolve these, resulting in file-not-found errors during diff validation. The same change would post fine for a user who entered the view through /view/<tag>, which made the failures look sporadic. We now detect the empty result and use the filesystem root as the view root. In a setview, VOBs appear directly under /, so this makes all generated paths view-relative again, matching what a /view-based workflow produces. Testing Done: - Added a unit test for get_local_path() in a setview context. - Ran unit tests.
    kvyqumtmwmvoootxkpvzskpmtnlkopxs
    Fix diff path generation when running inside a setview.
    On linux, users can enter a ClearCase view either through the view root (/view/<tag>/...) or with `cleartool setview`. In the setview case, `cleartool pwv -root` returns an empty string, which we stored as the root path of the view. Every path in the generated diff (the diff headers, the DiffX "path" fields, and the versionvault metadata) is computed with `os.path.relpath()` against that root path. With an empty root path, `relpath()` resolves against the current working directory instead, producing paths like "../gui2/bin/clearcase/Xmakefile" that depend entirely on where the user happened to run rbt. The server can never resolve these, resulting in file-not-found errors during diff validation. The same change would post fine for a user who entered the view through /view/<tag>, which made the failures look sporadic. We now detect the empty result and use the filesystem root as the view root. In a setview, VOBs appear directly under /, so this makes all generated paths view-relative again, matching what a /view-based workflow produces. Testing Done: - Added a unit test for get_local_path() in a setview context. - Ran unit tests.
    kvyqumtmwmvoootxkpvzskpmtnlkopxs

    Checks run (2 succeeded)

    flake8 passed.
    JSHint passed.