Author Topic: How do you commit correctly?  (Read 19547 times)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
How do you commit correctly?
« on: December 14, 2005, 02:46:39 pm »
I want to commit a new cbKeyBinder.

Do you drag the new code to ...\trunk\src\plugins\contrib\keybinder
and commit from there? Or do you drag the .svn data to a clean directory
and commit from there?

Its been a long time since I used any CVS like pgms, and I wasn't good at
it even then. I don't want to screw anything up.

Just asking before doing...

thanks
pecan
 

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: How do you commit correctly?
« Reply #1 on: December 14, 2005, 02:54:09 pm »
The normal procedure should be something like this:
1. Check out a working copy - 'svn checkout ...' or update an existing working copy - 'svn update'.
2. Make your changes to that working copy.
3. If your changes work, then do a 'svn commit' in the same directory where you did the 'svn checkout ...' (or 'svn update'). Thats all.

But note: This is a more general procedure. I can't say anything about special things here with Code::Blocks because I don't have write access to the repository. But I know no reason why anyone should ever go away form this procedure and use subversion in a different way.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How do you commit correctly?
« Reply #2 on: December 14, 2005, 04:36:36 pm »
The best solution in the current situation would be to check out HEAD and replace the source files (but not the .svn folder!) with your new versions.

For the future, you should check out either a full working copy of Code::Blocks or you can just check out the plugin's subdirectory and work in that. Seriously, work on the checked out version, that's why you call it a working copy. You have a lot of advantages when doing so. Then just commit when you're done.

Alternatively, since you are the plugin's maintainer, you may want to make a separate project at BerliOS and check out your working copies from that repository (and only commit to that repository, too). This again is easier for you, and it has a lot of advantages too (and no disadvantages at all).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: How do you commit correctly?
« Reply #3 on: December 14, 2005, 04:46:36 pm »
Ok, so I took my cbGet.cmd file and changed the "checkout" option to
"commit". But I get the following msg. Could someone point my
nose in the right direction??

Code
C:\Usr\Proj\cbBeta>cd trunk

C:\Usr\Proj\cbBeta\trunk>..\cbcommit

C:\Usr\Proj\cbBeta\trunk>PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32
\Wbem;\c:\usr\bin;c:\usr\bin\subversion\bin

C:\Usr\Proj\cbBeta\trunk>SET APR_ICONV_PATH=C:\usr\bin\Subversion\iconv

C:\Usr\Proj\cbBeta\trunk>svn --username {myname} --password {mypswd} commit svn:/
/svn.berlios.de/codeblocks/trunk
svn: Can't check path 'svn:\\svn.berlios.de\codeblocks\trunk': The filename, dir
ectory name, or volume label syntax is incorrect.

C:\Usr\Proj\cbBeta\trunk>

thanks
pecan

takeshimiya

  • Guest
Re: How do you commit correctly?
« Reply #4 on: December 14, 2005, 04:51:01 pm »
Can it be:

Because TortoiseSVN is a Windows Shell Extension, it is not able to use the notion of a current working directory. All working copy paths must be given using the absolute path, not a relative path.

?

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: How do you commit correctly?
« Reply #5 on: December 14, 2005, 04:53:37 pm »
thanks

But I don't even know what tortoiseSVN is. I entered the
cmd from WinXPsp2 cmd.exe winow while sitting in the
checked out /truck directory

thanks
pecan

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How do you commit correctly?
« Reply #6 on: December 14, 2005, 05:01:08 pm »
You cannot commit using svn://
Either you have to use svn+ssh:// or you use https://

You have a user account at BerliOS set up, I assume?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: How do you commit correctly?
« Reply #7 on: December 14, 2005, 05:09:58 pm »
thanks thomas


Yup, I created an account and got confirmation from Berlios.

I changed the svn line as instructed, but get the following reply

Code

C:\Usr\Proj\cbBeta\trunk>svn --username {me} --password {mypassword} commit svn+s
sh://svn.berlios.de/codeblocks/trunk
svn: Can't check path 'svn+ssh:\\svn.berlios.de\codeblocks\trunk': The filename,
 directory name, or volume label syntax is incorrect.

C:\Usr\Proj\cbBeta\trunk>

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How do you commit correctly?
« Reply #8 on: December 14, 2005, 05:12:06 pm »
Lol, wait, it does not work that way :)

1. You need a BerliOS account, but accounts are only updated via a cron job every 6 hours. So if your notice is not 6 hours old, then you will have to wait.

2. You have the choice of typing in your password a thousand times or using public key authentication instead. I strongly recommend the latter because it is not only more secure, but also more convenient.

3. Authentication tokens, too, are only updated every 6 hours, so do that NOW and save some time :)

4. You will either need Putty to create the SSH tunnel or you can use TortoiseSVN. You should get Putty in any case, because you need the key generator. Google for "putty", the first hit will get you there. Download the zip file that says "containing all the binaries": http://the.earth.li/~sgtatham/putty/latest/x86/putty.zip

5. Unpack, scan for viruses, and launch PUTTYGEN.EXE. Hit "Generate" and move the mouse until it is done, then enter your passphrase. Save your private key.
Copy the string in the textfield on top. This is important. You cannot just save the public key and upload that file, this won't work. You must copy the stuff in the "Public key for pasting...." field.
Go to the BerliOS site, log into your user account, go to "Account Options" and scroll all the way down. Click on "Edit keys" and paste your key there. Submit.

Sit back and relax while I type on, we have 6 hours now ...

6. Now you have the choice of using svn via the commandline or using TortoiseSVN. I occasionally use commandline for specific tasks, but generally you will want to use TortoiseSVN because it is a lot more convenient: http://tortoisesvn.tigris.org
Download that and install it (if you want, that is).

7. Open Putty.exe and enter svn.berlios.de under host name, and 22 under port name. On the left, go to Connection->Data and enter your username into "Auto-login username". Under Connection->SSH->Auth, click on "Browse" and locate the private key file that you saved earlier.
Click onto "Session" on top to get back to the first screen, enter a session name and save that session.
Put Pageant.exe into your autostart folder. Pageant will cache your passphrase in RAM, so you only have to enter it once. Edit the shortcut to pageant in your startmenu so it looks like C:\path\to\pageant.exe C:\path\to\private.key. Then pageant will load your key at startup and ask for the passphrase to unlock it, that is the most painless way.

8. If you plan to use command line, go to %APPDATA%\subversion and edit the file config. If you only use TortoiseSVN, you can skip this. Uncomment the section [tunnels] and enter the path to plink.exe like this:
[tunnels]
ssh = C:/tools/plink.exe

Be sure to use slashes, not backslashes. It will not work if you use backslashes.

9. Now for the actual work:
If you use TortoiseSVN, make a new folder, open that folder, and right-click inside it. Select "SVN Checkout..." and enter svn+ssh://YOURUSERNAME@svn.berlios.de/svnroot/repos/codeblocks/trunk into the dialog. Confirm and wait a few seconds. Then go to your plugin's folder and replace the files in there with your new files (but do not touch the .svn folder!). Right-click and select "SVN Commit...", you will be asked for confirmation and have the chance to select/deselect individual files and enter a comment. Click OK and you are done.
If you use command line, make a folder, navigate there, and type:
svn svn+ssh://YOURUSERNAME@svn.berlios.de/svnroot/repos/codeblocks/trunk. Put in the new files.
Then do a cd src\plugins\contrib\keybinder and type svn commit -m "A MESSAGE DESCRIBING YOUR CHANGES".
« Last Edit: December 14, 2005, 06:00:38 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: How do you commit correctly?
« Reply #9 on: December 14, 2005, 05:47:21 pm »
Code

C:\Usr\Proj\cbBeta\trunk>svn --username {me} --password {mypassword} commit svn+s
sh://svn.berlios.de/codeblocks/trunk
svn: Can't check path 'svn+ssh:\\svn.berlios.de\codeblocks\trunk': The filename,
 directory name, or volume label syntax is incorrect.

C:\Usr\Proj\cbBeta\trunk>

Try it without the URL. The commit command doesn't need it, it's saved in the working copy. In this case that working copy will have to be checked out using svn+ssh or https though. TortoiseSVN's "Relocate" command might come in handy if you didn't check it out that way (I'm not sure how to do this using command-line SVN).
Since you probably only want to commit the plugin and not any other changes you may have made you might also want to put "plugins\contrib\keybinder" where the URL used to be.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How do you commit correctly?
« Reply #10 on: December 14, 2005, 05:57:33 pm »
Try it without the URL.
That will not work, he checked out anonymously.
You cannot commit from an anonymous checkout.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2873
Re: How do you commit correctly?
« Reply #11 on: December 14, 2005, 06:13:05 pm »
Uh..

I check it out using my name and password just
as mandrav told me to.
Code
SET APR_ICONV_PATH=C:\usr\bin\Subversion\iconv
svn --username me --password mypswd checkout svn://svn.berlios.de/codeblo
cks/trunk

is that anonymous?

Anyway, this is all too much for me right now. It's gonna
take me days to do the stuff thomas described. I'm slow.
But I'll eventually get it figured out.

In the meantime would someone (thomas? ) be so kind as
to commit the attached keybinder code for me.


Thanks
pecan



[attachment deleted by admin]

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: How do you commit correctly?
« Reply #12 on: December 14, 2005, 06:17:25 pm »
Try it without the URL.
That will not work, he checked out anonymously.
You cannot commit from an anonymous checkout.

I did mention that, see TortoiseSVN's "Relocate" command I mentioned later in that paragraph.
That doesn't take away from the fact that he still needs to remove the URL, svn commit doesn't accept URLs (just a path to commit, defaulting to "."). That's what the error he got was referring to, and nobody mentioned that yet.

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: How do you commit correctly?
« Reply #13 on: December 14, 2005, 06:23:29 pm »
Uh..

I check it out using my name and password just
as mandrav told me to.
Code
SET APR_ICONV_PATH=C:\usr\bin\Subversion\iconv
svn --username me --password mypswd checkout svn://svn.berlios.de/codeblo
cks/trunk

is that anonymous?

Yes it is. On Berlios, http and svn are anonymous access, while https and svn+ssh are developer access (and thus allow commits).
Try either
Code
svn --username me --password mypswd checkout svn+ssh://svn.berlios.de/codeblocks/trunk
or
Code
svn --username me --password mypswd checkout https://svn.berlios.de/svnroot/repos/codeblocks/trunk
instead of that second line.
More information here, also randomly linked from the news box at the top of the forum pages.

If you have TortoiseSVN installed, its "Relocate" command combined with either of those URLs should also do the trick, and be much quicker (no need to redownload everything, just adjusts the working copy). But as I mentioned, I have no idea how to do that from the command line (and svn help doesn't list anything like that as far as I can see).
« Last Edit: December 14, 2005, 06:27:07 pm by Urxae »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How do you commit correctly?
« Reply #14 on: December 14, 2005, 06:25:05 pm »
It is not anonymous, but it is unsafe ;)  Don't do that. You are sending your username and password in plaintext over the internet... speaking of this, you may want to change your BerliOS password now.

For the server, however, it is as good as anonymous. Everything that is not SSH or https:// is non-authenticated to the server, even if you provide a password. Urxae is right with his objection, but it would not work either way. The server will not accept your commit if you are not authenticated.

Really, get TortoiseSVN. You want to, trust me. It takes 3 minutes to set up, and you can work with it.
If you do not do the whole installation which I described, the only drawback will be that TortoiseSVN will prompt you for your password every time, but that is something you can live with. It will still work!
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."