Show in Frame No Frame
Up Previous Next Title Page Index Contents Search

Turning off Version Control System integration

3.5.4 Save Version actions

Pressing Save Version will save the version number and comments and commit the current transaction. With the API integration for VCS and a valid _vcsWorkingDir() result, it will also handle creating a new version in the VCS. That consists of the following steps after the MetaEdit+ commit:
1)run _vcsPreCheckIn(): VCS tasks before emptying $vcsWorkingDir
2)delete contents of $vcsWorkingDir (leaves .svn/.git)
3)run _vcsRepositorySnapshot(): backupToDB:dir: to $vcsWorkingDir\versionedDB
4)open all unopened projects and calculate _vcsGraphSnapshot() results for all graphs
5)run _vcsMetamodelSnapshot() to $vcsWorkingDir\metamodel
6)write the _vcsGraphSnapshot() results to $vcsWorkingDir
7)if unopened projects were opened, close them and abandon
8)run _vcsCheckIn(versionComment): check in to local VCS (and remote, if present)

The VCS working directory is obtained by calling _vcsWorkingDir() in Graph. This returns $vcsWorkingDir, which is set to be $gitWorkingDir if $vcs='git' or $svnWorkingDir if $vcs='svn'. These in turn are built to be a $dbName subdirectory of $gitBaseDir or $svnBaseDir.

_vcsPreCheckIn() is only needed for the multi-user version of MetaEdit+, with each user having their own $vcsWorkingDir, and only for SVN. It allows us to rebase in SVN before emptying the working directory, because (unlike Git) SVN can not rebase with an empty directory or after it has been filled with the new files. The $vcsRebase variable in _vcsPaths() is set when we need to rebase, whether here for SVN or as part of CheckIn for Git.

Emptying the working directory in step 2) allows us to recognize when graphs etc. have been deleted. The contents of the working directory are thus exactly what we want in the next version, with no conflicts or merges necessary. In the multi-user version, we want this new version to succeed the latest version in VCS, not the previous version made by this user: the multi-user repository commit already makes sure we have all the other users’ changes, again avoiding the possibility of conflicts or the need for merges by the VCS.
->Emptying the working directory ignores entries beginning with a period ‘.’, e.g. .svn or .git. It copes silently with entries that cannot be deleted (e.g. because a file is open somewhere else), logging the file name and error name to the Repository Transcript).

Temporarily opening all unopened projects in step 4) makes sure we write all graph and metamodel snapshots, not just those in open projects. The VCS needs to have every file in each VCS version, otherwise it sees graphs that are missing because of closed projects as having been deleted.

The last step, _vcsCheckIn() will create and start the batch file to do the necessary VCS actions. You can resume working in MetaEdit+ while that runs. If a VCS command gives an error, the command prompt will pause, and you can interrupt the batch file with Ctrl+C. You can then correct the problem and manually issue the necessary VCS commands to finish the check in. You can see the commands from the batch file in the MetaEdit+ working directory.

To link the MetaEdit+ version with that in the VCS, the number, user and timestamp of the version are provided to the VCS as the first line of the version comment. Note that the timestamp provided there is in UTC: internally MetaEdit+ uses UTC, converting to the current time zone when displaying versions in the Changes tree.

The rest of the version comment sent to the VCS is the main Version comment followed by indented entries for the version’s non-empty transaction and graph comments.

Turning off Version Control System integration

If your MetaEdit+ license includes the API features, but you do not want Save Version to perform these extra actions, edit _vcsWorkingDir() and comment out its content so it gives no output.

If the output of _vcsWorkingDir() is non-empty and yet not a valid directory, or _vcs*() generators are missing, MetaEdit+ will show a warning and allow you to cancel or continue to version without the VCS integration. You can thus turn off VCS integration for all your repositories with a .vcsPaths file (see Section 3.5.6) in your MetaEdit+ working directory which results in an invalid _vcsWorkingDir(), e.g. by setting gitBaseDir=X:\git, where X: is a drive that does not exist. (This is indeed the initial value of gitBaseDir, to help avoid problems for those who investigate by pressing buttons rather than reading manuals!)

Show in Frame No Frame
Up Previous Next Title Page Index Contents Search