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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /cmake/Modules/G4GitUtilities.cmake (Version 11.3.0) and /cmake/Modules/G4GitUtilities.cmake (Version 11.0)


  1 #.rst:                                              1 #.rst:
  2 # G4GitUtilities                                    2 # G4GitUtilities
  3 # --------------                                    3 # --------------
  4 #                                                   4 #
  5 # .. code-block::cmake                              5 # .. code-block::cmake
  6 #                                                   6 #
  7 #   include(G4GitUtilities)                         7 #   include(G4GitUtilities)
  8 #                                                   8 #
  9 # CMake functions and macros for working with       9 # CMake functions and macros for working with Git where needed in
 10 # Geant4's build/packaging systems.                10 # Geant4's build/packaging systems.
 11 #                                                  11 #
 12                                                    12 
 13 #---------------------------------------------     13 #-----------------------------------------------------------------
 14 # License and Disclaimer                           14 # License and Disclaimer
 15 #                                                  15 #
 16 # The  Geant4 software  is  copyright of the C     16 # The  Geant4 software  is  copyright of the Copyright Holders  of
 17 # the Geant4 Collaboration.  It is provided  u     17 # the Geant4 Collaboration.  It is provided  under  the terms  and
 18 # conditions of the Geant4 Software License,       18 # conditions of the Geant4 Software License,  included in the file
 19 # LICENSE and available at  http://cern.ch/gea     19 # LICENSE and available at  http://cern.ch/geant4/license .  These
 20 # include a list of copyright holders.             20 # include a list of copyright holders.
 21 #                                                  21 #
 22 # Neither the authors of this software system,     22 # Neither the authors of this software system, nor their employing
 23 # institutes,nor the agencies providing financ     23 # institutes,nor the agencies providing financial support for this
 24 # work  make  any representation or  warranty,     24 # work  make  any representation or  warranty, express or implied,
 25 # regarding  this  software system or assume a     25 # regarding  this  software system or assume any liability for its
 26 # use.  Please see the license in the file  LI     26 # use.  Please see the license in the file  LICENSE  and URL above
 27 # for the full disclaimer and the limitation o     27 # for the full disclaimer and the limitation of liability.
 28 #                                                  28 #
 29 # This  code  implementation is the result of      29 # This  code  implementation is the result of  the  scientific and
 30 # technical work of the GEANT4 collaboration.      30 # technical work of the GEANT4 collaboration.
 31 # By using,  copying,  modifying or  distribut     31 # By using,  copying,  modifying or  distributing the software (or
 32 # any work based  on the software)  you  agree     32 # any work based  on the software)  you  agree  to acknowledge its
 33 # use  in  resulting  scientific  publications     33 # use  in  resulting  scientific  publications,  and indicate your
 34 # acceptance of all terms of the Geant4 Softwa     34 # acceptance of all terms of the Geant4 Software license.
 35 #                                                  35 #
 36 #---------------------------------------------     36 #-----------------------------------------------------------------
 37                                                    37 
 38 include_guard(GLOBAL)                              38 include_guard(GLOBAL)
 39                                                    39 
 40 #---------------------------------------------     40 #-----------------------------------------------------------------------
 41 #.rst:                                             41 #.rst:
 42 # .. cmake:command:: geant4_git_find_dirty         42 # .. cmake:command:: geant4_git_find_dirty
 43 #                                                  43 #
 44 #   .. code-block:: cmake                          44 #   .. code-block:: cmake
 45 #                                                  45 #
 46 #     geant4_git_find_dirty(<basedir> <modifie     46 #     geant4_git_find_dirty(<basedir> <modified> <untracked>)
 47 #                                                  47 #
 48 #   Runs ``git status`` in the ``<basedir>``,      48 #   Runs ``git status`` in the ``<basedir>``, writing lists of modified
 49 #   and untracked/ignored files to ``<modified     49 #   and untracked/ignored files to ``<modified>`` and ``<untracked>``
 50 #   respectively.                                  50 #   respectively.
 51 #                                                  51 #
 52 #   ``<basedir>`` must be the root of the repo     52 #   ``<basedir>`` must be the root of the repository queried, i.e. containing
 53 #   the ``.git/`` directory.                       53 #   the ``.git/`` directory.
 54 #                                                  54 #
 55 #   Nothing is returned in the output variable     55 #   Nothing is returned in the output variables if ``<basedir>`` is not a
 56 #   git repository or if a ``git`` executable      56 #   git repository or if a ``git`` executable cannot be located.
 57 #                                                  57 #
 58 function(geant4_git_find_dirty _basedir _outpu     58 function(geant4_git_find_dirty _basedir _output_modified _output_untracked)
 59   if(NOT EXISTS "${_basedir}/.git")                59   if(NOT EXISTS "${_basedir}/.git")
 60     return()                                       60     return()
 61   endif()                                          61   endif()
 62                                                    62 
 63   find_package(Git QUIET)                          63   find_package(Git QUIET)
 64   if(NOT Git_FOUND)                                64   if(NOT Git_FOUND)
 65     return()                                       65     return()
 66   endif()                                          66   endif()
 67                                                    67 
 68   execute_process(COMMAND ${GIT_EXECUTABLE} st     68   execute_process(COMMAND ${GIT_EXECUTABLE} status -s --ignored
 69     WORKING_DIRECTORY "${_basedir}"                69     WORKING_DIRECTORY "${_basedir}"
 70     OUTPUT_VARIABLE GEANT4_GIT_UNTRACKED           70     OUTPUT_VARIABLE GEANT4_GIT_UNTRACKED
 71     ERROR_VARIABLE GEANT4_GIT_UNTRACKED_ERROR)     71     ERROR_VARIABLE GEANT4_GIT_UNTRACKED_ERROR)
 72                                                    72   
 73   if(GEANT4_GIT_UNTRACKED_ERROR)                   73   if(GEANT4_GIT_UNTRACKED_ERROR)
 74     message(FATAL_ERROR "geant4_git_find_dirty     74     message(FATAL_ERROR "geant4_git_find_dirty: Calling `git status` failed with error: '${GEANT4_GIT_UNTRACKED_ERROR}'")
 75   endif()                                          75   endif()
 76                                                    76 
 77   if(GEANT4_GIT_UNTRACKED)                         77   if(GEANT4_GIT_UNTRACKED)
 78     set(_modded_files)                             78     set(_modded_files)
 79     set(_untracked_files)                          79     set(_untracked_files)
 80                                                    80 
 81     string(REPLACE "\n" ";" GEANT4_GIT_UNTRACK     81     string(REPLACE "\n" ";" GEANT4_GIT_UNTRACKED "${GEANT4_GIT_UNTRACKED}")
 82     foreach(item ${GEANT4_GIT_UNTRACKED})          82     foreach(item ${GEANT4_GIT_UNTRACKED})
 83       if(item MATCHES "^ *(M|A|R|D|C)")            83       if(item MATCHES "^ *(M|A|R|D|C)")
 84         string(REGEX REPLACE "^ *[MARDC][MARDC     84         string(REGEX REPLACE "^ *[MARDC][MARDC] *" "" _modded_path "${item}")
 85         list(APPEND _modded_files ${_modded_pa     85         list(APPEND _modded_files ${_modded_path})
 86       endif()                                      86       endif()
 87                                                    87 
 88       if(item MATCHES "^ *(\\!|\\?)")              88       if(item MATCHES "^ *(\\!|\\?)")
 89         string(REGEX REPLACE "^ *(\\!\\!|\\?\\     89         string(REGEX REPLACE "^ *(\\!\\!|\\?\\?) *" "" _untracked_path "${item}")
 90         list(APPEND _untracked_files "${_untra     90         list(APPEND _untracked_files "${_untracked_path}")
 91       endif()                                      91       endif()
 92     endforeach()                                   92     endforeach()
 93                                                    93 
 94     set(${_output_modified} ${_modded_files} P     94     set(${_output_modified} ${_modded_files} PARENT_SCOPE)
 95     set(${_output_untracked} ${_untracked_file     95     set(${_output_untracked} ${_untracked_files} PARENT_SCOPE)
 96   endif()                                          96   endif()
 97 endfunction()                                      97 endfunction()