Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-23914

Implement reformat-branch clang-format command



    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.3.8
    • None
    • None
    • Fully Compatible
    • Platforms 14 (05/13/16), Platforms 15 (06/03/16)


      lang_format.py script will have a new command:

      reformat-branch <no arguments>

      Reformat-branch will reformat an existing branch by applying clang-format to an existing set of changes in a branch. In order to work the script will need to know a suitable start point. The suitable start point will be the hash of the change that updates .clang-format to the new style format. This will be followed by an update of the script itself with the new hash to use as the starting point after the reformat commit has happened. The commits will be in git in the following order:

      1. Precursor changes like disabling format in tomcrypt.h (see SortIncludes discussion above)
      2. Commit to update .clang-format & clang_format.py
      3. Reformat change
      4. Commit to update clang_format.py with changes #2 & #3 for this command.

      Note: Yes lint will break on change 2, but I do not want one super change.

      The script will do the following steps:

      1. Validate branch has been rebased to hash XXX (Commit #2 above)
      2. For each commit in branch
        1. Checkout commit
        2. Reformat file as needed with clang-format
        3. Commit changes as YYY
        4. Move change YYY onto of reformat commit (Commit #3 above)




            mark.benvenuto@mongodb.com Mark Benvenuto
            mark.benvenuto@mongodb.com Mark Benvenuto
            0 Vote for this issue
            3 Start watching this issue