JP Vossen via plug on 23 Oct 2019 13:30:47 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Multiple in-line revision control


In "Mon Oct 21 - PLUG West - "Where's my Notepad? Transitioning to Desktop Linux" by Walt Mankowski (7pm at ATS)" we also talked about using Subversion with something else like Git or Hg in-line. I've been doing that for many years, as follows.

First, for various reason I have to use SVN at $WORK. Second, `svn ci` == both commit AND publish, which is annoying. Yes, you can use branches, but that's still a publish and they kinda suck in SVN. They suck a LOT less than they used to, but...

So what I do is use both Bzr (soon maybe Brz) and Svn at the same time. I use Bzr "natively" and only use Svn when I am ready to "publish" (think "push").

I set this up many years ago, but what I recall is:
1. Check out the SVN path you need
2. git init (or Bzr, Brz, Hg, whatever)
3. gitignore .svn
4. (Sigh) svn propset svn:ignore '.git' .
5. git add *

Then periodically you probably need to sync up files with adds/moves. If a lot of files are added, deleted or moved often, this will get very tedious. For my stuff, that's not a problem.

To publish and "sync" I have: svnci

```
#!/bin/bash -
# svnci--svn CI Wrapper for BZR integration

COMMIT_LOG='/tmp/Commit_Log_Message.txt'

# Get the commit log message
vi "$COMMIT_LOG"

# Do the svn CI
svn ci -F "$COMMIT_LOG" $*

# Get new rev
svn_rev=$(svnversion | perl -pe 's/^.*?:(\d+).*$/$1/;')

# Prepend the "Sync to SVN" message to the BZR log
echo ''
echo "Sync to SVN r$svn_rev for $*" > "$COMMIT_LOG.tmp"
cat "$COMMIT_LOG" >> "$COMMIT_LOG.tmp"
mv -f "$COMMIT_LOG.tmp" "$COMMIT_LOG"

# Do the BZR CI "sync"
echo 'BZR:'
bzr ci -F "$COMMIT_LOG" $*

```

You want to use `svnci` with either a specific list of files or with '.' so you get apples to apples commits, because Bzr or Git will commit the entire repo by default, while Svn will only do CWD and below.

This might look like a tedious pain, and it can be. But it also lets you use the required tool to publish, while still using a modern tool otherwise.


Side note, Brz = Breezy, the continuation of the Canonical Bzr Bazaar tool, but Brz also has a first-class goal of being a "friendly" front-end to a native Git back-end.

Later,
JP
--  -------------------------------------------------------------------
JP Vossen, CISSP | http://www.jpsdomain.org/ | http://bashcookbook.com/
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug