How to check for working copy in tortoise svn - tortoisesvn

I am confused in switching from trunk to branch .How to check for my current working copy in svn during switching

Using TortoiseSVN, you can see in the file properties whereabouts you are in the repository. If you right-click on the file, select Properties then look at the Subversion tab, the first entry will be URL. This will be displayed something like:
path_to_repository/trunk/filename
or
path_to_repository/branches/branch_name/filename
The URL is what would be updated if you were to commit that file. In the first example, you would be working in the trunk, in the second example, you would be in a branch.

If your question can be decrypted as
"I want to know, to which part of repository linked my WC at the time"
you have to use svn info command, URL parameter
>svn info
...
URL: http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk
...

Related

How can i add an 'unversioned file' to github?

I am trying to use GitHub for the first time and have managed to upload a small project i am working on.
The problem is that all of my files but one are being added to GitHub - i created this file after committing the project and have tried right clicking and 'ADD' but this does not seem to work.
Does anyone have any ideas of what the problem could be? I understand this is probably a fault on my behalf, i am just not able to figure out what i must do to rectify it.
Using "ADD" without "COMMIT" only informs git that the added file should be included in the next commit, but it doesn't trigger any action itself.
You need to commit the file after using "ADD" in order for it to be versioned.
So:
Right click on the file -> ADD
VCS Menu -> Commit changes
Your file should appear on the list with the tick next to it. Click commit and you are good to go.
Do you have a git bash? If no, I recommend installing it, then try:
Run Git bash -> go to your project directory
git status -> should produce sth like "Untracked files: "
git add .
git commit -m "YourMessage"
git push
This should add your file to git versioning and push it to the GitHub repository.
The most common reason for this is there is no change seen. Try making another change to the file, even if you just add spaces to the end of one of he lines. Then save and try the commit again.
I had the same problem after creating the repository and committing; the only file committed was the MainActivity.java file, all other files were showing as 'unversioned file'.
Make sure to change your Project Window view to 'Project'.
Then right click your project and select Git --> +Add.
All files will be updated and the "unversioned" list will be gone.

TortoiseSVN switch Branches

I have used svn for a while but recently a couple teams were added to the project. One of the teams made a new branch and has asked me to check some of their changes. I went to the directory, right click, svn->switch and chose the new branch. I went in and tried to echo something to the page I was on to see if I was working in the new branch and I wasn't. This is a little beyond what I do but with the project getting so big I need to learn this.
Based on that, my question..is there something more to this that I am not doing? After switching the working copy to this new branch how do I work on it?
The difference between checkout and switch might be adding to the confusion. I think that in your case it would be simpler to just check out the branch to a different folder since you're just doing review and it may be the most straightforward way to proceed regardless.
See this section from the Tortoise docs:
To Checkout or to Switch...
...that is (not really) the question. While a checkout downloads
everything from the desired branch in the repository to your working
directory, TortoiseSVN → Switch... only transfers the changed data to
your working copy. Good for the network load, good for your patience.
:-)
To be able to work with your freshly generated branch or tag you have
several ways to handle it. You can:
TortoiseSVN → Checkout to make a fresh checkout in an empty folder.
You can check out to any location on your local disk and you can
create as many working copies from your repository as you like.
Switch your current working copy to the newly created copy in the
repository. Again select the top level folder of your project and use
TortoiseSVN → Switch... from the context menu.
In the next dialog enter the URL of the branch you just created.
Select the Head Revision radio button and click on OK. Your working
copy is switched to the new branch/tag.
Switch works just like Update in that it never discards your local
changes. Any changes you have made to your working copy which have not
yet been committed will be merged when you do the Switch. If you do
not want this to happen then you must either commit the changes before
switching, or revert your working copy to an already-committed
revision (typically HEAD).
If you want to work on trunk and branch, but don't want the expense of
a fresh checkout, you can use Windows Explorer to make a copy of your
trunk checkout in another folder, then TortoiseSVN → Switch... that
copy to your new branch.
In the regular "Properties" dialogue (right click on Windows explorer) you have a "Subversion" tab that will tell you what URL the file or directory points to. Use that to verify that you actually switched to the correct branch.
It's also worth nothing that any non-committed local changes will still be in your working copy.
There might be a misconception about svn switch :
At first I thought that the existence of a switch command would imply that there were a "current" or a "selected" working copy for the proper functioning of SVN. Like I'm currently working on trunk, then I'm working on a branch B, hence "switching" from a working copy to another. The truth is : there is no such thing as a current working copy ! There are just many local working copies : one for the trunk, one for a branch another for a tag and so on. But none would be "implicitly selected".
As Paul Sasik quotes : switch would allow, for instance, to have only one working copy of say, the trunk, and then, merging that local working copy with a targeted branch or tag from the remote repository. switch only sync differences between local and remote, hence avoiding to do a whole check out of a solution. Past exectution of command, every further commits on the working copy will occur on the distant repository folder which's been switched to, which's been targeted. No matter what the initial check out was for that local folder.

How do I undo a deleted trunk that someone else has checked in?

My project directory inside trunk has been accidentally deleted by another user.
I can see my project when browsing it through the web at one revision (364), but the top of the tree it is missing (370)
How do I undo those commits and get my source tree back using the command line subversion client?
EDIT:
Thanks for all the hints. It was a combination of answers that helped me solve it. Although Avi's answer is the closest to the one that allowed me to restore the source tree. So I'll accept that. Although to be totally correct, below is what worked for me since even the trunk directory was eventually removed!
Final solution was:
svn cp https://xxx.xxx.xxx/url/trunk#364 https://xxx.xxx.xxx/url
I then checked this out locally:
svn co https://xxx.xxx.xxx/url/trunk
Copied my changes into this. Double check it builds without issues.
Followed by:
svn up
svn commit
You can copy it back to the current revision:
svn cp -r<revision where it existed> <project-url> <project-url>
EDIT:
Note that if you have changes to your working copy, you need to take care that they don't get overwritten when updating the working copy.
In this case, I suggest you copy them somewhere safe, then doing the svn cp I suggested above, and doing svn up to update your copy, before copying your local changes back in and committing.
svn up -r[revision]
Find the revision number first by doing svn log

Is it possible to create a branch from a tag in TortoiseSVN without first checking out the tag from SVN server?

Our trunk directory contains about 100mb of code and we create tags from the trunk directory. Normally, this is not an issue because a tag takes up no space until you need to use it for something. Since branches are created from tags in SVN, how can I create a branch from a tag wtihout first checking out the tag? It appears I need to do a Tortoise Update from Windows Explorer to get the tag down to my local machine before I can use Tortoise > Branch/Tag... to create a branch from it. This seems illogical since we don't make changes to tag folders, and it requires that I check out 100mb of code, only to create a branch, and then check out another 100mb of code in the branch folder, where the changes will actually be made.
Ideally, I'd be able to create a branch directly in the repository via RepoBrowser - but I can't see an option for it there.
Am I missing something?
Creating a branch is just a matter of copying the desired directory to another location. This can be done directly in the Repo Browser.
There is nothing special that differentiates a branch from a tag as far as Subversion is concerned. It is just a convention to store them under separate parent folders, named 'branches' and 'tags' accordingly.
The only difference between tags and branches is your attitude towards them -- they are equivalent behind the scenes -- shadow copies made in the repository.
You don't even need a working copy to create a branch/tag. For example, you can use this command-line:
svn copy http://server/test/trunk http://server/test/branch -m "make branch"
(assumes you have SVN.EXE in addition to TortoiseSVN, otherwise, use Ben's answer)

Using tortoiseSVN, how do you tag the code?

Using TortoiseSVN, how do you tag the code?
Is the process to branch exactly the same?
I know you have to just copy the code to the /tag/ folder, but how?
i.e. I want to copy revision # to a tag#.
Will it affect the /trunk/ at all?
The answers here were missing some key information for getting started with SVN and braches.
Step 1: You need to make sure you have a suitable branches/tags dir. e.g. if your project has this structure:
url/myproj/trunk/...
you also need:
url/myproj/tags/
url/myproj/branches/
To do this, don't "add" the directories and commit them, or tortoise will give you an error. Instead use the tortoise svn repo-browser, go to myproj then right click and "add Folder".
Step 2: Right click on your trunk folder, select "tortoise SVN" then "branch/tag". The copy branch/tag dialogue now pops up.
Step 3: Set the "to Path" to "/myproj/tags/myversion" where myversion is usually something like "1.0". Select "Head revision in the repository" and make sure "switch working to new branch/tag" is not checked. Hit OK.
Step 4: Unfortunately, next time you do an update, it will pull down the branches and tags as files. This means your HD will get filled with every file from every branch and version created. One solution is to only checkout each individual trunk dir, which is not always convenient (as you have to manually update 30 trunk dirs if you have one repo with 30 projects).
Personally, having used CVS, SCCS, PVCS, VSS & Rational for 30 years, I find SVN much harder to work with.
Right click on your project folder and select Branch/Tag
Point the URL to whatever you want the folder to be called inside the /Tag/ folder
Select Specific revision in repository and choose the one you want
It won't affect the trunk at all.
How to create a tag :
Right click on your repository local copy
Choose Create a branch or a tag...
Choose URL of the tag (normally at the same level that trunk you have a tags folder)
Choose which revision you want to tag
(Usually, you will choose HEAD revision. Why ? Because normally tags are to mark a state of your repository typically for release management, and then when you have the repository state wished, you tag it and then continue the development.
Yes, it's almost the same process that for branches, the difference is "conceptual".
No effect to your trunk !
Here's the official documentation.
Creating a tag won't affect the trunk nor your working copy (you'll still be pointing to trunk) unless you switch to the newly created tag or branch.
Answers below:
The process is almost exactly the same as a branch.
A branch is a tag which is updated essentially.
Right click on the folder you want to tag, click on RepoBrowser, then branch/tag.
Modify the ToURL, with where you want to place your tag
Enter your comment/tag in the box below.
This will tag the code in the folder, without moving it.
This will not effect the trunk at all.

Resources