Uploaded image for project: 'Crucible'
  1. Crucible
  2. CRUC-7444

Running crucible.py throws error: Expected diff hunk descriptor but found

    XMLWordPrintable

Details

    Description

      Summary

      When creating a Crucible Review using the crucible.py script, the Review is not created successfully.

      Environment

      • Perforce repository

      Steps to Reproduce

      1. Modify a file in your repository (e.g. add a line)
      2. Modify ("touch") a second file in your repository by using p4 edit file-2.txt
      3. Run the crucible.py script

      Expected Results

      The crucible.py script completes, and a Crucible Review is created.

      Actual Results

      The below exception is thrown in the command line output file and the Crucible Review is not created:

      Server Error: com.cenqua.crucible.revision.diff.patchDiff.PatchException: Unrecognised diff format. Expected diff hunk descriptor but found: ... depotFile //depot/<PATH_TO_FILE>/file-2.txt
      

      Notes

      The crucible.py script performs a p4 -z tag diff -du command.

      This returns "empty diffs" in the following format:

      ... depotFile //depot/<PATH_TO_FILE>/file-2.txt
      ... clientFile /tmp/repository/depot/<PATH_TO_FILE>/file-2.txt
      ... rev 1
      ... type text
      

      Instead of the expected format, which occurs when an actual change has been applied to a file and looks like the following:

      ... depotFile //depot/<PATH_TO_FILE>/file-1.txt
      ... clientFile /tmp/repository/depot/<PATH_TO_FILE>/file-1.txt
      ... rev 1
      ... type text
      
      @@ -412,8 +412,12 @@
       var a = 1;
      +var b = 2;
       var c = 3;
      

      Workaround

      The not expected changes (without any change to the content of the file) can be reverted by using the perforce command:

      p4 revert -a
      

      After the changes have been reverted, the crucible.py script completes and the Crucible Review is created.

      As described on the Perforce documentation:

      the -a flag reverts only files that are open for edit or integrate and are unchanged or missing. Files with pending integration records are left open. The file arguments are optional when -a is specified.

      An alternative is to use the following:

      p4 diff -sr | p4 -x- revert
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vpetrychuk Vitalii Petrychuk
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: