Using Piston to manage external applications
I just received a mail from Walter McGinnis asking:
In other words start a new client project based on an existing open source project that is an entire rails application like Typo or Mephisto and be able to update, modify, and merge accordingly like you would for plugins with piston.
Walter proposed to use the following technique:
1 2 3 4 |
svn checkout repos_for_new_client_project new_client_project cd new_client_project piston import repos_for_third_party_open_source_rails_app_like_typo/trunk/app app piston import repos_for_third_party_open_source_rails_app_like_typo/trunk/db db |
This would work, but as Walter says:
… it doesn’t seem very DRY.
Since this isn’t the first time I am being asked the question, I decided to investigate a solution. I ended up with something that works just fine. The technique boils down to simply not creating trunk/ and using Piston to create that folder. You have to start from a fresh project to use this technique.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
$ piston version
Piston 1.3.3
$ svn checkout svn://my-server/project/ ~/project/
Checked out revision 0.
$ cd ~/project/
$ piston import \
http://svn.techno-weenie.net/projects/mephisto/trunk/ \
trunk/
Exported r2856 from 'http://svn.techno-weenie.net/projects/mephisto/trunk/' to 'trunk/'
$ svn commit --message "Imported Mephito trunk@2756"
# Some time later...
$ cd ~/project/
$ piston update .
Processing '.'...
Fetching remote repository's latest revision and UUID
Restoring remote repository to known state at r2756
Updating remote repository to r2857
Processing adds/deletes
Removing temporary files / folders
Updating Piston properties
Updated to r2857 (56 changes)
$ svn commit --message "Updated Mephisto to r2857 (56 changes)" |
If you use Piston to manage sub-directories (such as vendor/rails), everything will still work:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$ svn update At revision 2. $ piston import http://dev.rubyonrails.org/svn/rails/trunk vendor/rails/ Exported r6957 from 'http://dev.rubyonrails.org/svn/rails/trunk' to 'vendor/rails' $ svn commit --message "Imported Rails into vendor/rails at r6957" $ svn update $ piston update Processing '.'... Fetching remote repository's latest revision and UUID unchanged from revision 2857 Processing 'vendor/rails'... unchanged from revision 6957 |
October 12th, 2007 at 10:25 PM
Nice! Like most things, it seems almost obvious once you see how it’s done. But not before.
October 12th, 2007 at 10:25 PM
Very weird. I finally got around to actually using this and it’s failing on the piston import step:
I have double-checked that I’m running piston 1.3.3, too. I was able to do a straight svn checkout of the Kete project via the http repository, so lack of access to that repository from my box seems out. I also tried the Mephisto repository and got the same error.
Thoughts?
Cheers,
Walter
October 12th, 2007 at 10:25 PM
Here’s an update. This works:
Notice that I used “file://” rather than “svn+ssh://”. I set up a local repository just to test my theory that somehow the problem lies with the protocol I was using. I was right.
There are two possibiliities:
My bet is on it being my problem, but I thought I would mention it incase it’s a something that someone else comes across. I’ll continue testing.
Cheers,
Walter
October 12th, 2007 at 10:25 PM
Yep. Looking like some sort of networking problem on my end. I tried “svn+ssh” again, but pointing at a repository on localhost and it worked.
No it’s not a bug in Piston.
Cheers, Walter
October 16th, 2007 at 07:38 AM
I’ve been wondering how to do this for months—thanks for the explanation!
December 11th, 2007 at 11:51 PM
I ran across your blog because I had the same problem. I discovered that the reason it was failing for me was because I was using on old version of svn (1.1.x) on the server side. “svn info” returns nothing when querying against the root of a repositoty with a pre-1.2 svnserve (see http://svn.haxx.se/dev/archive-2007-08/0502.shtml ). This causes the undefined method `[]’ error (at least on my side).
To anyone else having the problem: You can see the svn commands that piston is trying to run by adding the ‘-v’ argument. Then try running the command right before the error occurs.