Merging dataΒΆ
The strong points of Git are its branching and merging capabilities. They allow developing new features independently. Dsynq does not have its own branching commands. Instead, it follows Git branches.
When you make a branch in Git, Dsynq promotes the data from the parent commit on to the new branch just like it does for any parent to child commits.
When you make a Git merge, Dsynq backtraces the merge and tries to make a union of the two incoming data directories automatically. In case of conflicts, you have to resolve them by picking the correct version of the two conflicting files.
As an example, add a new feature to hello-dsynq
in a separate branch. Make a new feature branch new_feature_branch
and then develop the feature by changing the codebase as well as the data on new_feature_branch
.
Change the codebase.
> git checkout -b new_feature_branch
Switched to a new branch 'new_feature_branch'
> echo new feature> changelog.txt
Change the data.
> dsynq checkout
receiving incremental file list
receiving incremental file list
Checkout done
Data for b99acb8669514bd7200da26abbefabf2b723db23 checked out
When finished, don't forget to check in the data to unlock it for others
> echo data for the new feature> data/new_feature.dat
Commit the source code.
> git add changelog.txt
warning: LF will be replaced by CRLF in changelog.txt.
The file will have its original line endings in your working directory.
> git commit -m "new feature"
[new_feature_branch fa496af] new feature
1 file changed, 1 insertion(+)
create mode 100644 changelog.txt
Check in the data.
> dsynq checkin
sending incremental file list
data/
data/new_feature.dat
25 100% 0.00kB/s 0:00:00
25 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/3)
sending incremental file list
Promoting data from b99acb8669514bd7200da26abbefabf2b723db23 to fa496afb9d1d5a910e1c64492a98624e85a2e284
Warning: Checking in the data for the preceding commit
Compressing database delta(s)...
No databases found
Database delta(s) compressed
Data checked in successfully!
The new_feature_branch
branch has data/new_feature.dat
.
> git status
On branch new_feature_branch
nothing to commit, working tree clean
> ls -la data/
total 6
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:19 .
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:19 ..
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:18 .databases
-rw-r--r-- 1 dsynq 197121 19 Jun 8 07:19 big.dat
-rw-r--r-- 1 dsynq 197121 25 Jun 8 07:19 new_feature.dat
Now switch back to your master
branch and make some changes there too.
> git checkout master
Switched to branch 'master'
> echo copyright>> readme.txt
> git add readme.txt
warning: LF will be replaced by CRLF in readme.txt.
The file will have its original line endings in your working directory.
> git commit -m "added copyright"
[master 9aab118] added copyright
1 file changed, 1 insertion(+)
Even though you are on the master
branch, data/new_feature.dat
from new_feature_branch
is still available locally.
> git status
On branch master
nothing to commit, working tree clean
> ls -la data/
total 6
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:19 .
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:19 ..
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:18 .databases
-rw-r--r-- 1 dsynq 197121 19 Jun 8 07:19 big.dat
-rw-r--r-- 1 dsynq 197121 25 Jun 8 07:19 new_feature.dat
This happens because the local data remains unchanged as long as you don't run dsynq checkout
or dsynq get
. Even then there is an option to exclude some of the data subdirectories from synchronizing.
Back to merging. Usually Dsynq implicitly promotes the data from the parent to the child commit on the remote. You can also do this explicitly with dsynq remote catchup
.
> dsynq remote catchup
Promoting data from b99acb8669514bd7200da26abbefabf2b723db23 to 9aab118140521615d55f916ef7f8f71916cc5b0c
> dsynq get
receiving incremental file list
deleting data/new_feature.dat
data/
receiving incremental file list
Data downloaded successfully!
> ls -la data/
total 5
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:19 .
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:19 ..
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:18 .databases
-rw-r--r-- 1 dsynq 197121 19 Jun 8 07:19 big.dat
Notice that data/new_feature.dat
is gone as a result of dsynq get
.
You have changes on both new_feature_branch
and master
branches. Merge the new feature into master
, the code and the data.
> git merge new_feature_branch
Merge made by the 'recursive' strategy.
changelog.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 changelog.txt
> dsynq remote merge
Merge found at 2272ae9e2a3aff02208dcc549e9cfaf9849891e5
Merging the following:
9aab118140521615d55f916ef7f8f71916cc5b0c
Git: Dsynq User Fri Jun 8 07:19:59 2018 +0000
added copyright
Dsynq: dsynq Fri Jun 8 07:19:16 2018
updated big.dat
fa496afb9d1d5a910e1c64492a98624e85a2e284
Git: Dsynq User Fri Jun 8 07:19:49 2018 +0000
new feature
Dsynq: dsynq Fri Jun 8 07:19:49 2018
<None>
Unlike Git which merges source code locally, Dsynq merges data on the remote. In order to have the merged data locally, you have to get them.
> dsynq get
receiving incremental file list
data/
data/new_feature.dat
0 0% 0.00kB/s 0:00:00
25 100% 24.41kB/s 0:00:00 (xfr#1, to-chk=0/3)
receiving incremental file list
.databases/
Data downloaded successfully!
The new feature, both the code and the data, is on the master
branch tip.
> ls -la && ls -la data/
total 12
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:20 .
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:18 ..
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:18 .dsynq
-rw-r--r-- 1 dsynq 197121 26 Jun 8 07:18 .dsynqconfig.yaml
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:20 .git
-rw-r--r-- 1 dsynq 197121 51 Jun 8 07:18 .gitignore
-rw-r--r-- 1 dsynq 197121 13 Jun 8 07:20 changelog.txt
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:20 data
-rw-r--r-- 1 dsynq 197121 28 Jun 8 07:19 readme.txt
total 6
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:20 .
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:20 ..
drwxr-xr-x 1 dsynq 197121 0 Jun 8 07:20 .databases
-rw-r--r-- 1 dsynq 197121 19 Jun 8 07:19 big.dat
-rw-r--r-- 1 dsynq 197121 25 Jun 8 07:19 new_feature.dat
Tag this v0.3
.
> git tag v0.3