Reputation: 101
Skip to the bottom for the TLDR.
Issue:
In our environment everyone uses Dropbox to collaborate the development of a large coding project. It solves the problem of everyone keeping up to date on what everyone else has changed, and it also provides some simple versioning as to "whom changed what, and when".
What Dropbox does not provide, which is what I am looking for, is Git's awesome sauce, as far as versioning, blame, content diffs, etc
What I am working with now:
I am still using dropbox as our "version control, because the other "devs" probably won't be able to figure out git, I know it's easy, but they hate change.
In order for me to see, "what's really happening, and who's doing it", I am tracking the entire dropbox folder for that project using Git.
I have to manually commit every once in a while on behalf of the other devs in order to track what's happening with Git's awesome sauce.
What I am looking for:
Does anyone have experience with the environment I am stuck in? I would like to find something that can notice a change in Dropbox, pull the username of who made that change using dropbox's API, and auto-commit the change to git.
I have not found any such solution, and have already begun writing an app in Python to do what I want, I might have to host this on github and ask for help, low on free time, and relatively new to Python.
I am able to pull the RSS feed from the dropbox API and parse out what the file was and who changed it, but am not far enough to hook it into a Git Commit, should be trivial. I just don't want to reinvent any wheels.
TLDR:
I would like to automatically track changes that occur in a dropbox folder, and have them Git Committed, including the name of the person who changed the file in dropbox, using dropbox's API, or similar. Likely using Python, but anything is welcome.
Thanks in advance.
Git Repo, in case you want to help! https://github.com/haqthat/git-drop
Upvotes: 10
Views: 669
Reputation: 9568
I have used dropbox as a git repo following something on the lines of http://tumblr.intranation.com/post/766290743/using-dropbox-git-repository
So from that, the simplest way I can think of is:
1) Init a repo in your dropbox folder (This will auto-sync across everyone you share it with)
2) Configure it with a remote on github or your own git server if any. This way all changes across files and users will be tracked at the remote.
3) Write a script as a cron job that periodically commits from your local dropbox and then runs against the remote git server and looks for deltas and revisions. You can get that from Dropbox API ref starting here - https://www.dropbox.com/developers/reference/api#revisions
4) After doing the above, you might want to include a call to https://www.dropbox.com/developers/reference/api#metadata which as per dropbox returns a hash that can be used to track changes and then call your polling script. As of now there doesn't seem like there is a way for dropbox to notify you of changes other than you polling every few minutes to the remote.
hash Each call to /metadata on a folder will return a hash field, generated by hashing all of the metadata contained in that response. On later calls to /metadata, you should provide that value via this parameter so that if nothing has changed, the response will be a 304 (Not Modified) status code instead of the full, potentially very large, folder listing. This parameter is ignored if the specified path is associated with a file or if list=false. A folder shared between two users will have the same hash for each user.
Upvotes: 1
Reputation: 28005
Honestly, your team needs one week of git practice and then will benefit from a much more robust workflow. Don't try to automate commits. Thats leading down the road to hell.
Upvotes: 4
Reputation: 14900
If you can host it on linux, how about using iwatch? Whenever a file is updated in the dropbox folder by dropbox sync, iwatch can run a python script when that happens to pull the user. Then use envoy to run the two git commands, git add 'filename'
and git commit -m "autocommit by system for user X changes"
.
Sure it isn't very pretty, but it will do the job, and it won't run unless there is an update.
Upvotes: 2