Versioning dataΒΆ

Dsynq provides version control of project's data in the context of Git commits. Git commit represents a state of the project's codebase. When you run dsynq checkin, Dsynq uploads the files in data/ to the remote and links them to the current commit. This way for each state of the codebase (e.g a Git commit), you have the matching data. If you don't explicitly change or remove data files between two commits, Dsynq assumes the previous ones are still relevant.

Note

Dsynq Professional and Enterprise automatically back up the data before updating it with dsynq checkout or dsynq checkin.

In Dsynq basics you finished off hello-dsynq at v0.1. In this section, continue from there and create v0.2 by, first, updating big.dat and then adding readme.txt.

Make changes to the data.

> dsynq checkout
receiving incremental file list
data/
receiving incremental file list

Checkout done

Data for 07a93783bc28f788ede49ab98e206ba372baeec7 checked out
When finished, don't forget to check in the data to unlock it for others
> echo big data file v0.2> data/big.dat

Make changes to the codebase.

> echo readme file v0.2> readme.txt

Commit the source code before checking in the data, so that the next checkin goes into the new commit.

> 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 readme"
[master b99acb8] added readme
 1 file changed, 1 insertion(+)
 create mode 100644 readme.txt
> git tag v0.2

Check in the data into v0.2.

> dsynq checkin -m "updated big.dat"
sending incremental file list
data/big.dat

             19 100%    0.00kB/s    0:00:00
             19 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/2)
sending incremental file list
Promoting data from 07a93783bc28f788ede49ab98e206ba372baeec7 to b99acb8669514bd7200da26abbefabf2b723db23

Warning: Checking in the data for the preceding commit

Compressing database delta(s)...
No databases found
Database delta(s) compressed

Data checked in successfully!

Now hello-dsynq has the commits and the corresponding data saved for both v0.1 and v0.2. You can go back and forth between commits and retrieve the matching version of the data as needed.

Currently, you are at v0.2.

> git tag -l --points-at HEAD
v0.2

Go to v0.1.

> git checkout v0.1
Note: checking out 'v0.1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 07a9378... initial commit
> dsynq get
receiving incremental file list
data/big.dat

              0   0%    0.00kB/s    0:00:00
             19 100%   18.55kB/s    0:00:00 (xfr#1, to-chk=0/2)
receiving incremental file list

Data downloaded successfully!
> cat data/big.dat
big data file v0.1
> cat readme.txt
cat: readme.txt: No such file or directory

As expected, data/big.dat is at v0.1 as in Dsynq basics while readme.txt is missing because hello-dsynq v0.1 did not have a readme.

Now go back to the latest commit, v0.2.

> git checkout master
Previous HEAD position was 07a9378... initial commit
Switched to branch 'master'
> dsynq get
receiving incremental file list
data/big.dat

              0   0%    0.00kB/s    0:00:00
             19 100%   18.55kB/s    0:00:00 (xfr#1, to-chk=0/2)
receiving incremental file list

Data downloaded successfully!
> cat data/big.dat
big data file v0.2
> cat readme.txt
readme file v0.2

Both the codebase and the data are at v0.2. Command dsynq get, as the name implies, downloads the remote data for the current commit but does not make a checkout.

You can have data checked out only for one commit at any time point. To abandon the current checkout without checking in the data, call dsynq checkout --cancel. You don't even have to identify the commit. Dsynq will cancel the current checkout whatever commit it belongs to.