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

6 Responses to “Using Piston to manage external applications”

  1. George Anderson Says:

    Nice! Like most things, it seems almost obvious once you see how it’s done. But not before.

  2. Walter McGinnis Says:

    Very weird. I finally got around to actually using this and it’s failing on the piston import step:

    ~/$ svn co svn+ssh://somebody@somewhere/usr/local/svn/project
    Checked out revision 0.
    
    ~/$ cd project
    
    ~/project/$piston import http://svn.kete.net.nz/projects/kete/trunk/ trunk/
    /var/lib/gems/1.8/gems/piston-1.3.3/lib/piston/commands/import.rb:21:in `run': undefined method `[]' for false:FalseClass (NoMethodE\rror)
            from /var/lib/gems/1.8/gems/piston-1.3.3/lib/transat/parser.rb:131:in `execute'
            from /var/lib/gems/1.8/gems/piston-1.3.3/lib/transat/parser.rb:127:in `each'
            from /var/lib/gems/1.8/gems/piston-1.3.3/lib/transat/parser.rb:127:in `execute'
            from /var/lib/gems/1.8/gems/piston-1.3.3/lib/transat/parser.rb:104:in `parse_and_execute'
            from /var/lib/gems/1.8/gems/piston-1.3.3/bin/piston:10
            from /var/lib/gems/1.8/bin/piston:18:in `load'
            from /var/lib/gems/1.8/bin/piston:18
    

    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

  3. Walter McGinnis Says:

    Here’s an update. This works:

    $ svn co file:///home/walter/test-svn-repos/project
    Checked out revision 0.
    
    $ cd project
    
    $ piston import http://svn.kete.net.nz/projects/kete/trunk/ trunk/
    Exported r717 from 'http://svn.kete.net.nz/projects/kete/trunk/' to 'trunk/'
    

    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:

    • Piston can’t communicate with my Subversion repository because of some network problem (firewall or ssh keys related) on my end. This would seem the most likely.
    • Since I’m using Piston in a somewhat non-standard way, i.e. not managing vendor directory, I’ve found an unusual bug in Piston.

    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

  4. Walter Says:

    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

  5. Andy Stewart Says:

    I’ve been wondering how to do this for months—thanks for the explanation!

  6. Wade Simmons Says:

    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.

Leave a Reply

 

Search

A picture of me

I am François Beausoleil, a Ruby on Rails coder. During the day, I work on XLsuite. At night, I am interested many things. Read my biography

Tags

(3) (1) (0) (2) (1) (1) (2) (2) (1) (2) (1) (2) (1) (2) (1) (1) (1) (1) (2) (14) (1) (1) (1) (1) (2) (1) (1) (2) (0) (1) (2) (1) (3) (1) (1) (1) (1) (1) (1) (0) (3) (2) (1) (2) (2) (1) (3) (2) (8) (8) (9) (12) (1) (1) (3) (1) (1) (1) (1) (1) (1) (2) (2) (2) (1) (1) (3) (1) (3) (1) (0) (23) (1) (1) (0) (1) (1) (1) (23) (25) (1) (1) (13) (1) (1) (2) (3) (1) (1) (4) (1) (2) (3) (0) (1) (7) (3) (1) (5) (5) (2) (2) (2) (4) (6) (7) (1) (0) (1) (1) (2) (2) (1) (4) (12) (2) (1) (2) (4) (1) (1) (1) (2) (8) (2) (3) (2) (2) (1) (3) (1) (1)

Links

Projects I work on

Categories

Archives