Overview

Version Merger is a Python script which can be used to automatically save snapshots of a file as it changes.

Licensed under the MIT License - https://opensource.org/licenses/MIT

Features

System Requirements


Version-Merger Diagram


Animated Tutorial

   
 
 
 
 
 
   
 
 
 
 
 
 


Getting started

Download

Clone the latest repository version from Github (recommended): $ git clone https://github.com/facerecog/version-merger.git

Alternatively, download the .tar.gz file from the top of this page and unpack it: $ wget https://github.com/facerecog/version-merger/tarball/master -O - | tar -xz

Now cd into the newly extracted directory.

Alternatively, install using pip: sudo pip install version-merger


How the script works

version-merger.py takes in the following parameters:

Every r seconds, version-merger.py uses git stash to save any changes in the input file i. Every t seconds, version-merger.py will merge all stashed content into output file o.


Verify that it works

Run the following script that writes a random value in dump.csv every second:
python example/randomizing_csv.py

Open a new terminal and run version-merger.py as such: python version-merger.py -i dump.csv -o mastercopy.csv -t 60 -r 1

If you have many files to track, you may use filename globbing as such:
python version-merger.py -i dump*.csv -o mastercopy.csv -t 60 -r 1

Code Example

Code Example

For the sake of brevity, this example merges its stashed versions of dump.csv every 3 seconds:

$ python version-merger.py -i dump.csv -o mastercopy.csv -t 3 -r 1
Reinitialized existing Git repository in /home/di/Desktop/FaceRecog/t/version-merger/.git/
[master b1d1ef5] First Commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 clone.csv
Saved working directory and index state WIP on master: b1d1ef5 First Commit
HEAD is now at b1d1ef5 First Commit
Submitted
dump.csv
Saved working directory and index state WIP on master: b1d1ef5 First Commit
HEAD is now at b1d1ef5 First Commit
Submitted
dump.csv
Saved working directory and index state WIP on master: b1d1ef5 First Commit
HEAD is now at b1d1ef5 First Commit
Submitted
dump.csv
HEAD is now at b1d1ef5 First Commit
Done
cat: tempclone.csvtemp.csv: No such file or directory
HEAD is now at b1d1ef5 First Commit
Done
HEAD is now at b1d1ef5 First Commit
Done
Saved working directory and index state WIP on master: b1d1ef5 First Commit
HEAD is now at b1d1ef5 First Commit
Submitted
dump.csv

... and so on.


Uninstall

If you installed version-merger using pip, run the following to uninstall it: sudo pip uninstall version-merger

Otherwise, simply delete the version-merger folder.


Support

If you want to support this project, please consider reaching out to me via muhd.amrullah@facerecog.asia


Property of Facerecog Asia Pte. Ltd. and 26 Factorial