Xavier,

Thanks for the info.  I got another email from Brad King and he also pointed 
out the same thing:

    
https://cmake.org/cmake/help/v3.6/command/ctest_start.html#command:ctest_start

and then Brad updated the documentation for ctest_update() to state that it 
will just keep you on whatever tracking branch you are on and do a git pull 
(after doing a reset --hard to wipe out any local changes).

With is info, I can do what I need.

Thanks,

-Ross


Dr. Roscoe A. Bartlett, PhD
Sandia National Laboratories
Trilinos Software Engineering and Integration Technologies Lead
Consortium for the Advanced Simulation of Light Water Reactors (CASL) Physics 
Integration Infrastructure Lead

From: xavier.besse...@gmail.com [mailto:xavier.besse...@gmail.com] On Behalf Of 
Xavier Besseron
Sent: Wednesday, June 08, 2016 10:45 AM
To: cmake@cmake.org
Cc: Bartlett, Roscoe A
Subject: [EXTERNAL] Re: [CMake] Get ctest -S script to pull from git branch 
other than 'master'?

Hi Ross,

Here is how I do it in my case:

...

# Initial checkout if no source directory
if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
  message("Initial checkout...")
  set(CTEST_CHECKOUT_COMMAND "git clone --branch ${GIT_BRANCH} ${REPOSITORY} 
${SOURCE_DIR_NAME}")
endif()

# Initialize testing
message("Initialize ${CTEST_MODEL} testing...")
ctest_start(${CTEST_MODEL} TRACK "${CTEST_SUBMISSION_TRACK}")

message("Update source...")
set(CTEST_GIT_COMMAND "git")
ctest_update(RETURN_VALUE NB_CHANGED_FILES)
message("Found ${NB_CHANGED_FILES} changed file(s)")

...


I hope this helps.

Best regards,

Xavier


On Tue, Jun 7, 2016 at 11:04 PM, Bartlett, Roscoe A 
<raba...@sandia.gov<mailto:raba...@sandia.gov>> wrote:
Hello,

Is there a built-in way to get a ctest -S script to checkout and pull from a 
git branch other than ‘master’?  I can’t seem to find a way to so this and 
there is no mention of branches at all in the official documentation:

    
https://cmake.org/cmake/help/v3.6/command/ctest_update.html?highlight=ctest_update

and there is no mention of “branch” at:

    https://cmake.org/Wiki/CMake/Testing_With_CTest

Currently, I see code that people have written which is explicitly checking out 
and updating the desired branch after ctest_update() is called (e.g. this what 
TribitsCTestDriverCore.cmake does).  Therefore, this CTest code is really just 
using ctest_update() to do a `git fetch` on the external repo.  In this case, 
if the local branch is changed to a tracking branch, then will ctest_update() 
leave that tracking branch as is and just pull from the tracking branch the 
next time the ctest –S script is called?  If that is the case, then I would 
expect CTest to report the correct list of “updated files”.  But if 
ctest_update() instead switches back to the ‘master’ branch and then does the 
pull, then it will likely report the wrong list of “updated files”.

I can dig into the source code for CTest to see what it actually does but it 
would be nice to have direct support for choosing the branch or at the very 
least just documenting the current behavior and describe the best way to work 
around the issue.

Thanks,

-Ross


Dr. Roscoe A. Bartlett, PhD
Sandia National Laboratories
Trilinos Software Engineering and Integration Technologies Lead
Consortium for the Advanced Simulation of Light Water Reactors (CASL) Physics 
Integration Infrastructure Lead


--

Powered by www.kitware.com<http://www.kitware.com>

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--
Dr Xavier BESSERON
Research associate
FSTC, University of Luxembourg
Campus Kirchberg, Office E-007
Phone: +352 46 66 44 5418
http://luxdem.uni.lu/

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to