<table><tr><td style="">thomasfischer updated this revision to Diff 71145.<br />thomasfischer marked 4 inline comments as done.<br />thomasfischer edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-zanpw73alqayslh/">(Show Details)</a><br />thomasfischer edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-i5ci2iuvmvd43im/">(Show Details)</a><br />thomasfischer added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D24641">View Revision</a></tr></table><br /><div><div><p>I tried to address the most recent comments:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Added documentation at the file's beginning in comments. Not sure how to test if syntax, though. Spelling, grammar, and wording should be checked as well (not a native speaker).</li>
<li class="remarkup-list-item">Functions <tt style="background: #ebebeb; font-size: 13px;">`ecm_source_version_control_probe_branch</tt><tt style="background: #ebebeb; font-size: 13px;"> and </tt><tt style="background: #ebebeb; font-size: 13px;">ecm_source_version_control_probe_revision</tt>` now have an 'outvar'. When invoking either of the functions, a variable name needs to be passed where the result is stored inside.</li>
<li class="remarkup-list-item">Locating the Git binary has been refactored into a 'private' function <tt style="background: #ebebeb; font-size: 13px;">`_ecm_source_version_control_detect_git</tt>`.</li>
</ul></div></div><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><div style="padding: 8px 0;">...</div>Code from KBibTeX's `getgit.cmake` was refactored to fit `ECMSourceVersionControl.cmake`<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> and similar code has been added to support Subversion and other version control systems</span>.<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">The following information is extracted from version control systems:<br />
* `ECM_SOURCE_VERSION_CONTROL_BRANCH` will contain the name of the branch, such as for example `master` for Git or `^/trunk` for Subversion<br />
* `ECM_SOURCE_VERSION_CONTROL_REVISION` is the current revision, such as the SHA1 hash in Git or `r` followed by a number in Subversion<br />
* `ECM_SOURCE_VERSION_CONTROL_COMMIT_COUNT` is the direct number of commits from the origin of the history until the current revision</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">By loading this module</span>, <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">excluding any other branches.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">two variables will be set:</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Different version control systems are supported to different degrees:<br />
* Git is fully supported thanks to the mature code from `getgit.cmake`<br />
* Subversion is well supported except for the question wheter to use `last-changed-revision` or just `revision` and how to correctly compute the commit count (some `svn log ... | grep -c ...` won't be available)</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">* A boolean variable `ECM_SOURCE_UNDER_VERSION_CONTROL` tells whether the current source directory is managed by a known version control system (VCS).</span><br />
* <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Mercurial support only covers `ECM_SOURCE_VERSION_CONTROL_BRANCH` but not `ECM_SOURCE_VERSION_CONTROL_COMMIT_COUNT` or `ECM_SOURCE_VERSION_CONTROL_REVISION`<br />
* Bazaar is virtually incomplete</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">String variable `ECM_SOURCE_VERSION_CONTROL_WHICH` contains an identifier which VCS is used, e.g. "git".<br />
<br />
In case Git is used, functions `ecm_source_version_control_probe_revision` and `ecm_source_version_control_probe_branch` allow the retrieve the checkout's revision (8-character hex string) and branch (e.g</span>. <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">However</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">'master')</span>, <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">this seems to be a dead project anyway</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">respectively</span>.<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Due to its incomplete support, this revision requires input from people more familiar with Subversion, Mercurial, and Bazaar</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">The documentation inserted at the beginning of the module explains the set variables and provided functions in greater detail</span>.</div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;"># Create a temporary directory and copy a <span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">`</span>.git<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">`</span> directory from another project into this directory<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> in order to have some data to work with</span>.<div style="padding: 8px 0;">...</div># Just by <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">inclu</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">loa</span>ding this module, variable<div style="padding: 8px 0;">...</div>include(ECMSourceVersionControl)<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"><br />
# The following two functions do not print anything except</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">message("ECM_SOURCE_UNDER_VERSION_CONTROL=" ${ECM_SOURCE_UNDER_VERSION_CONTROL})</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"># warnings, but set variables</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">message("ECM_SOURCE_VERSION_CONTROL_WHICH=" ${ECM_SOURCE_VERSION_CONTROL_WHICH})<br />
<br />
# In order to retrieve the revision and branch</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"># ECM_SOURCE_VERSION_CONTROL_REVISION and</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"># of the checkout in the source directory, the</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"># ECM_SOURCE_VERSION_CONTROL_BRANCH, respectively, given</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"># following two functions may be helpful:</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"># that no error occurred and the version control system is</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">ecm_source_version_control_probe_revision(ECM_SOURCE_VERSION_CONTROL_REVISION)</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"># Git.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">ecm_source_version_control_probe_branch(ECM_SOURCE_VERSION_CONTROL_BRANCH)</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">ecm_source_version_control_probe_revison(</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">message("ECM_SOURCE_VERSION_CONTROL_REVISION=" ${ECM_SOURCE_VERSION_CONTROL_REVISION}</span>)<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">ecm_source_version_control_probe_branch(</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">message("ECM_SOURCE_VERSION_CONTROL_BRANCH=" ${ECM_SOURCE_VERSION_CONTROL_BRANCH}</span>)<div style="padding: 8px 0;">...</div># invoke ecm_source_version_control_probe_revis<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">i</span>on() and<div style="padding: 8px 0;">...</div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R240 Extra CMake Modules</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D24641?vs=69225&id=71145">https://phabricator.kde.org/D24641?vs=69225&id=71145</a></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D24641">https://phabricator.kde.org/D24641</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>modules/ECMSourceVersionControl.cmake</div></div></div><br /><div><strong>To: </strong>thomasfischer, sitter, kossebau<br /><strong>Cc: </strong>kde-frameworks-devel, kde-buildsystem, LeGast00n, GB_2, bencreasy, michaelh, ngraham, bruns<br /></div>