<div dir="ltr"><font face="arial, helvetica, sans-serif">Hi Ross,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Here is how I do it in my case:<br></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><br></div></div><div><div><font face="monospace, monospace">...</font></div></div><div><div><br></div></div><div><div><div><font face="monospace, monospace"># Initial checkout if no source directory</font></div></div></div><div><div><font face="monospace, monospace">if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")</font></div></div><div><div><font face="monospace, monospace">  message("Initial checkout...")</font></div></div><div><div><font face="monospace, monospace">  set(CTEST_CHECKOUT_COMMAND "git clone --branch ${GIT_BRANCH} ${REPOSITORY} ${SOURCE_DIR_NAME}")</font></div></div><div><div><font face="monospace, monospace">endif()</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace"># Initialize testing</font></div></div><div><div><font face="monospace, monospace">message("Initialize ${CTEST_MODEL} testing...")</font></div></div><div><div><font face="monospace, monospace">ctest_start(${CTEST_MODEL} TRACK "${CTEST_SUBMISSION_TRACK}")</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><span style="font-family:monospace,monospace">message("Update source...")</span></div></div><div><div><font face="monospace, monospace">set(CTEST_GIT_COMMAND "git")</font></div></div><div><div><font face="monospace, monospace">ctest_update(RETURN_VALUE NB_CHANGED_FILES)</font></div></div><div><div><font face="monospace, monospace">message("Found ${NB_CHANGED_FILES} changed file(s)")</font></div></div><div><br></div><div><font face="monospace, monospace">...</font></div></blockquote><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I hope this helps.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Best regards,</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Xavier</font></div><div><font face="monospace, monospace"><br></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 7, 2016 at 11:04 PM, Bartlett, Roscoe A <span dir="ltr"><<a href="mailto:rabartl@sandia.gov" target="_blank">rabartl@sandia.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">    <a href="https://cmake.org/cmake/help/v3.6/command/ctest_update.html?highlight=ctest_update" target="_blank">
https://cmake.org/cmake/help/v3.6/command/ctest_update.html?highlight=ctest_update</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">and there is no mention of “branch” at:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">    <a href="https://cmake.org/Wiki/CMake/Testing_With_CTest" target="_blank">
https://cmake.org/Wiki/CMake/Testing_With_CTest</a> <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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”. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-Ross<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border:none;border-bottom:solid windowtext 1.0pt;padding:0in 0in 1.0pt 0in">
<p class="MsoNormal" style="border:none;padding:0in"><u></u> <u></u></p>
</div>
<p class="MsoNormal">Dr. Roscoe A. Bartlett, PhD<u></u><u></u></p>
<p class="MsoNormal">Sandia National Laboratories<u></u><u></u></p>
<p class="MsoNormal">Trilinos Software Engineering and Integration Technologies Lead<u></u><u></u></p>
<p class="MsoNormal">Consortium for the Advanced Simulation of Light Water Reactors (CASL) Physics Integration Infrastructure Lead<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Dr Xavier BESSERON<br>Research associate<br>FSTC, University of Luxembourg<br>Campus Kirchberg, Office E-007<br>Phone: +352 46 66 44 5418<br><div><a href="http://luxdem.uni.lu/" target="_blank">http://luxdem.uni.lu/</a><br></div><div><br></div></div></div>
</div>