SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using subversion with rails: a real pain for dirs and files added?

    We know that with subversion if i modfy files in my working copy everythink is transparent when i will do a commit. Instead if i add files or directory to the working copy i must use the related svn subcommands such as svn add for example. But this is a pain in rails where in a working day with my working copy i will add many autogenerated files and directory. At the end of the day when i'm ready to commit i have to remember every files in every directory or directories that rails (or me) added to the project and i have to run the svn add command for each of them. Am i wrong? What is at the end the benefit of using it?

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Code:
    ./script/generate controller Whatever --svn
    Automatic checkin to subversion...

  3. #3
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia View Post
    Code:
    ./script/generate controller Whatever --svn
    Automatic checkin to subversion...
    wow i didn't know that option to the generator script
    Is it documented somewhere?

    Anyway someone has told me that a "svn add", with no argument, to the root rails app directory, will discover and schedule to add to the repository new files and directory whithin this rails app. Which way is the best and most used among rails developers? If i choose your way, do i have to do that only for generated stuff?

  4. #4
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can see all files that are yet to be added by running:

    Code:
    $ svn st | sed "s/^? //"
    To add them all:

    Code:
    $ svn st | sed "s/^? //" | xargs svn add
    Create an alias for the above command in your bash profile and you're golden.

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Skyblaze View Post
    wow i didn't know that option to the generator script
    Is it documented somewhere?
    I found it on the Rails Wiki a long time ago, there's a detailed page there on using Rails and Subversion together.

  6. #6
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Luke Redpath View Post
    You can see all files that are yet to be added by running:

    Code:
    $ svn st | sed "s/^? //"
    To add them all:

    Code:
    $ svn st | sed "s/^? //" | xargs svn add
    Create an alias for the above command in your bash profile and you're golden.
    why use that odd command when you can use "svn add" only?

  7. #7
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are running Windows as your development environment and using SVN, I would highly recommend installing TortoiseSVN. With that installed, you can right click on the root of your application and commit. The Explorer plug-in will then list all the files that may need including in the commit. The items that are controlled by SVN and have changed since the last commit will be checked, but also files that are not in the repository and may need to also be included in the commit, will also be listed but unchecked. If you review that list before confirming the commit, it is usually fairly simple to pick up any files you've forgotten.

    Also, the alterations of file icons in Windows explorer make it fairly easy to detect files that are either out of step with the repository or not included.

    This link shows the right click menu additions, alteration of icons and an example explorer view of files.

  8. #8
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On the same note, svn with rails...
    I'd like svn to ignore my log directory... I can't seem to get the svn:ignore propset working... Anyone got an example?
    If you give someone a program,
    you will frustrate them for a day;
    if you teach them how to program,
    you will frustrate them for a lifetime.

  9. #9
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Skyblaze View Post
    why use that odd command when you can use "svn add" only?
    svn add with no options doesn't do anything. There's nothing odd about chaining powerful unix commands together once you get to know them. Besides, as I said I've set it up a bash alias for the whole command so all I actually have to type is:

    Code:
    $ aaa
    I could have called it anything though.

  10. #10
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pjleonhardt View Post
    On the same note, svn with rails...
    I'd like svn to ignore my log directory... I can't seem to get the svn:ignore propset working... Anyone got an example?
    You should be adding 'log' to the svn:ignore property of the root of your rails app. No need to add a trailing slash.

    Personally I think you're better off ignoring specific files as you'll still need the log folder when you run a fresh checkout. So from the root of your Rails app run:

    Code:
    $ svn propset svn:ignore log/
    Then add:

    Code:
    *.log
    *.pid
    Or simply '*' if you really do want to ignore everything in there.

  11. #11
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As a side note, I wouldn't really recommend using the --svn switch with the generators unless you plan on checking the generated files in straight away; if you don't, then you'll have added files lying around that you might not necessarily want to check in at that point. Say an issue comes up that needs to be fixed there and then; you'd now have to go to the trouble of listing each individual file you want checking in so as not to check in all of the added files (that aren't relevant to that changeset).

    Its almost always a good idea to not run svn add until you are ready to check in and only then svn add the files you need.

  12. #12
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if i run:

    svn add * --force

    ...it adds every unversioned file and/or dir if i type that command in the root of the app.

  13. #13
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I keep getting this if I try to set it on files:
    svn: Cannot set 'svn:ignore' on a file ('log/development.log')
    If you give someone a program,
    you will frustrate them for a day;
    if you teach them how to program,
    you will frustrate them for a lifetime.

  14. #14
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pjleonhardt View Post
    I keep getting this if I try to set it on files:
    svn: Cannot set 'svn:ignore' on a file ('log/development.log')
    You can only set it on a directory. Add development.log to the svn:ignore for the log/ folder.

  15. #15
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help Luke.

    I also found this page:
    http://wiki.rubyonrails.org/rails/pa...WithSubversion
    Which is a great help and has some scripts too
    If you give someone a program,
    you will frustrate them for a day;
    if you teach them how to program,
    you will frustrate them for a lifetime.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •