3.5.2 Getting started
To get started, open a Changes & Versions tool with
Repository |
Changes & Versions, and choose
VCS
Settings |
Paths.... This opens the
_vcsPaths()
generator from Graph, which contains the settings for VCS integration:
| the
name to use for this MetaEdit+ repository in your VCS,
$dbName. By default in a new repository
this uses __(internal 'dbName' read) to
pick up the name of the repository shown in the Startup Launcher; it is better
to change this to simply assign the name as a fixed string, e.g.
$dbName =
'demo' |
| your
choice of VCS, $vcs = 'git' or
$vcs =
'svn' |
| the
base VCS working directory on your
disk,
$gitBaseDir
/
$svnBaseDir |
| the
base URL of a VCS repository: optional
$gitBaseURL for
Git (e.g. a GitHub account URL), an obligatory
$svnBaseURL
repository for SVN. |
The full paths to the
working directory on your disk and to the URL are then formed by appending the
name you chose for your MetaEdit+ repository. Under a single base directory and
URL you can thus have multiple MetaEdit+ repositories, each of which is
versioned separately.
In this section we will detail the settings necessary for
a single user MetaEdit+ repository. Extra information for multi-user
repositories is provided in Section
3.5.5.
On Linux, note that you must install
xterm.
MetaEdit+ generates VCS and shell commands in
.bat files, and these are run via the
metarun script, which opens them in
xterm and runs them as
bash
scripts.
Git
Install Git – you can use the defaults or your own
preferences. When MetaEdit+ runs Git commands, it will add Git to the path as
needed, use Git’s built-in credential caching, and use the cmd terminal
(or xterm on Linux).
On your OS command line, run the following:
git config --global user.name "Your Name"
git config --global user.email your@email.address
Select
VCS Settings |
Paths to adjust
_vcsPaths() to fit your needs, choosing
$vcs='git'. Make sure the
$gitBaseDir and
$gitExeDir point to the desired
directories, and that those directories already exist. The
$gitWorkingDir will be built from
$gitBaseDir by
appending the given
$dbName.
Save your changes to
_vcsPaths().
Git does not necessarily require a
$gitBaseURL
– the local working directory has a full git repository in itself. You can
have a
$gitBaseURL if you want, and
versioning will then keep that remote git repository in sync with your local
working directory’s git repository. The remote git repository must already
exist or be created manually: You can set up an account on GitHub or
Bitbucket.org, and create an empty git repository there with the same name as
dbName in
_vcsPaths(). You should set
$gitBaseURL to the URL for your
account;
$gitProjectURL will be built
from that by appending the given
$dbName.
Select
Extra VCS Commands |
Init to run
_vcsInit(). This, and its
_vcsInit_git() subgenerator, will
create and run gitInit.bat to:
| create
the working directory for this MetaEdit+ db,
|
| set
up credential caching to remember the password for this
$gitProjectURL (you will be prompted
for the password on the command line, once only),
|
| set
the necessary file types and line end handling for this platform and
multi-platform use, and
|
| set
up the link to $gitProjectURL, if
non-empty. |
TortoiseSVN and SVN
If on Linux, simply install SVN (1.8 or later). If on Windows,
install TortoiseSVN (1.8 or later). Plain SVN lacks certain functions that are
needed on Windows for VCS integration. A TortoiseSVN installation will include
SVN, and MetaEdit+ calls those SVN commands directly to perform some tasks, and
opens a TortoiseSVN window for other tasks that require a UI.
SVN requires an
$svnBaseURL (can
be a remote URL, or a file:/// URL for a local SVN repository) and requires that
the SVN repository exists.
Create the directories: by default we use X:\svn and an
X:\svn\svn_working base directory within which we will have a working directory
per MetaEdit+ repository.
If you are creating a local SVN repository rather than
using an existing remote repository, create the empty SVN repository:
| On
Windows: create X:\svn\svn_repos, right-click it and choose TortoiseSVN |
Create Repository Here.... You do not need to choose ‘Create folder
structure’. |
| On
Linux: snvadmin create
/home/myUser/svn/svn_repos |
Select
VCS Settings | Paths to adjust
_vcsPaths() to fit your needs, choosing
$vcs='svn'. Make sure the
$svnBaseDir and
$svnBaseURL point to the desired
locations, and that those locations already exist.
On Windows the settings for a local SVN repository might
be:
$svnBaseDir = 'X:\svn\svn_working'
$svnBaseURL = 'file:///X:/svn/svn_repos'
On Linux the
settings for a local SVN repository might be:
$svnBaseDir = '/home/myUser/svn/svn_working'
$svnBaseURL = 'file:///home/myUser/svn/svn_repos'
The
$svnWorkingDir and
$svnProjectURL will be built from these
by appending the given $dbName.
Save your changes to
_vcsPaths().
Select
Extra VCS Commands |
Init to run
_vcsInit().This, and its
_vcsInit_svn() subgenerator, will
create and run svnInit.bat to create an SVN project for your MetaEdit+ db.
If on Windows, when pressing
Save
Version to check in, remember to always press the
All link above the file list in the TortoiseSVN dialog that opens, so
that added and deleted files are
versioned.