Context:
I'm working on a big UE4 project. Currently we're using SVN as our VCS, but I've always been a git developer and having a local repo, local branches, and stashes are things I'm not willing to loose.
So, I've started using SubGit to work on a git version of the repo, while subgit does the git to svn conversion. So far I love it, aside from the fact that I'm forced to use rebase instead of merge, everything else is like normal git.
EDIT 1: My subgit repo is bare local one, as I don't have access to the remote SVN repo. This means tools like svnadmin
or svnlook
don't work for me.
Question:
Now, my team works by locking the binary files they work on in SVN. I want an automatic way to join that workflow. So I thought about a pre-commit hook to check if the files I'm about to commit are locked. If not, then lock them immediately. If they are though, check if I'm the lock owner. If I'm not, abort the commit.
Does anyone have any clues of how to achieve something like this?
After a lot of research, trial and error finally got something that WORKS!! I added all these comments so ppl can understand my logic, as I still believe it can be improved.
EDIT 1: created a gist to host the file, to keep track of any improvements made to it pre-commit gist
For instance, I'm accessing the remote repo once per file. When the round-trip is long that's quite inefficient if the commit contains several .uasset files. Instead, it would be cool to batch all files info request on a single svn info request. I don't know if that's possible.
Also, the way I'm grabbing the Lock owner username is too hacky, but at least it does the trick for my case. Couldn't succeed to grab a string from between two single quotes on the second grep. Instead, I'm matching the username pattern which of course only works in my scenario where all svn usernames used in my company are of the form name.lastname
Super open to improvements! Please suggest them in the comments