I'm using TortoiseSVN without an external Subversion server to manage LabView source (i.e. a large collection of ever-changing binary files).
I'd like to have a "beta" branch of the repository that anyone can subscribe to and get daily updates. I guess this is different from a usual beta release series with separate branches, but it's right for this project.
What is the best/easiest way to copy the contents of a particular revision of the trunk branch over to the beta branch? Essentially what I want to do is delete the old contents of beta and insert new contents. Delete+add would work, I suppose, but it's clearly suboptimal. Merge is not an option unless I can get Tortoise to automatically resolve all conflicts in the trunk's favor, including deleting files.
Update: a couple people have asked why I don't want delete+add. I'd like a cleaner alternative.
This method leads to half the updates to the beta tree being "wipe out last rev."
The updates are not atomic so someone could pick up an empty release.
I haven't tried and seen, but beta wouldn't be a proper branch. Would the revision log even track multiple revisions at all, since it's a "new" file each time?
Update 2: svn allows any arbitrary commands before a commit, but I couldn't get Tortoise to work this way. After selecting "Delete," stub directories were still left over until I committed, at which point I could repopulate the branch. There needs to be a way to unmark a directory for deletion when it exists in both the old and new tag revisions.
Merge is not an option unless I can
get Tortoise to automatically resolve
all conflicts in the trunk's favor,
including deleting files.
I don't know about TortoiseSVN, but if you install the command line client you could do the following to merge the latest trunk changes to a beta branch:
cd c:/path/to/my/working/copy/of/beta/branch
svn merge file:///c:/path/to/my/repository/trunk --accept theirs-full
svn commit -m "merged latest trunk changes to beta branch"
The --accept theirs-full option resolves all conflicts by using the trunk's version like you want.
This has some advantages: subversion will do representation sharing, so files stored on both branches will not take extra space in the repository. Also, when users update their beta working copy, only the files that were changed need to be pulled over the wire.
SVN is transactional - a delete and copy (not add!) would not be problematic. And beta would be a proper branch (or better a tag)
Why not delete beta/* and then copy trunk/* to beta/ ?
Related
I had a functional version of code which I was trying to commit to my local branch,
However, previously I tried to make some changes that were not accepted on that branch. So I reverted back to a previous commit.
So I was working out of a commit that was 2nd to last in the branch
Then I made some more changes, tested the program, and tried to commit again,
Then tortoise svn forced me to update, I assumed it was updating the files for the current revision I was on. But no, unfortunately, it Updated the files to the Latest commit, which I did not want, then it tried to merge my changes on top of that, so I had changes that I wanted on top of changes that I didn't want merged together!
Can I undo this and keep my changes that I just made that I wanted to commit? What did I forget to do, was I supposed to stash all of the newer commits?
Right click on file you will have option replace with choose the local history. Select the local version you want to keep.
Its done. You are good to go :)
I have added a file (say SomeFile.cs) to a specific folder. I did not commit as I wanted to do commit at once after achieving the functionality. An svn update worked just fine on this until someone changed the folder name and changed the names of files under it.
Now the next day when I did svn checkout, resulted in tree level conflicts, so I copied my newly added files to this "new" location and did as "Resolve using theirs".
The resolve deleted all my local files and replaced with new folder and files. I could not find my local files (which were in my working copy) in my entire computer (includint recycle bin).
Now is there at least an option to retrieve the files which were added ("Add" option) to svn and NOT committed to svn using "Commit"?
Regards
AFAIK, only files committed to svn will be recoverable. But if you merge the conflict with theirs, then it would have overriden the changes locally.
Try to "Update to revision", but as your files were NOT committed it will most likely restore your directory structure in best case scenario.
Generally "Resolve using theirs" option is an equivalent of saying "I screwed up, they are right" -> whatever I have is wrong, and what they have is right -> overwrite my copy.
What you are asking for is pretty much against the workflow of SVN. Things don't get stored in the repository until they are committed, and are thus not "safe". You are supposed to commit often.
If you are trying to work but worried about other people's tree changes getting in your way, consider making a branch.
http://svnbook.red-bean.com/en/1.7/svn.branchmerge.html
However, SVN should never overwrite files in your local working copy that have modifications. If you do an svn update, and someone has added/changed something, you will get a "conflict", which you will have to resolve manually. You resolved these conflicts manually, and accidentally overwrote you work. This is why you should commit often. Anything you commit can be recovered.
I typically work on small-sized projects that involve only 2-3 people working on the same codebase concurrently.
The usual routine for me is as follows:
Scour through bug reports, pick a bug by priority, and write the fix
Create a diff/patch (let's call it patch "alpha") of the changes to the codebase (ie: svn diff > ~/diff_alpha.patch)
E-mail the patch to colleagues where they can visually inspect the diff against the codebase and point out errors or suggestions
They tell me what changes are required, I put them in, and then re-email my team with the modified patch
Once everyone agrees that the patch is good, I apply it to the codebase, merging in other people's changes if necessary, re-build, re-test, and commit.
The problem here is that I usually have to wait a couple of days for all the approvals for the modified final patch to come in, and during that time I (obviously) want to work on other patches.
If I go work on another bug and it affects the same file I'm working on in the previous patch, it means that when I want to commit the previous patch (alpha), I have to:
Backup my current work to a new patch (ie: patch "bravo"), via svn diff > ~/diff_bravo.patch
Revert my current working copy (svn revert -R .)
Apply the old patch (patch -p0 < ~/diff_alpha.patch)
Commit the old patch (svn commit)
Apply the patch I was previously working on (patch -p0 < ~/diff_bravo.patch)
Continue working on the code related to diff_bravo.patch
This is annoying as I generally have to hand-merged conflicts between diff_alpha and diff_bravo.
The other approach I tried was just continuing my work on diff_alpha without creating a diff_bravo. Then, when I have approval for all the code in the original diff_alpha I e-mailed out, I do the following:
Backup my current work to a new patch (ie: patch "temp"), via svn diff > ~/diff_temp.patch
Revert my current working copy (svn revert -R .)
Apply the old patch (patch -p0 < ~/diff_alpha.patch)
Commit the old patch (svn commit)
Apply the patch I was previously working on (patch -p0 < ~/diff_temp.patch)
Now I can continue what I was doing without having to hand-merge, but I will receive tons of fails hunks in my "patch" command as half the code in diff_temp was already committed in diff_alpha. I do not find this acceptable.
Any recommendations for handling multiple tasks/bugs on a common file so I can minimize SVN conflicts?
This is what branches are for. You create a branch for each bug and work in that branch until you are ready to consult with your team mates. The branch can be checked out by the team members and inspected (update when you did new changes). When everyone agrees, merge branch back to trunk.
The team members can check the log of each change you made to the branch (essentially your patch in your question) or open the changed file and see the applied changes in context (they can even access previous version(s) of the files to see how it was before the change).
You still have to alert your team members to check the changes, but do not have to explicitly send them the change youself -- they will get it from the cental repository.
You can have multiple branches (one for each bug) and can work on them simultaneously. When merging to the trunk, SVN should do the merge automatically (occasionally pointing out conflicts, which you can resolve manually.
The conflicts might arise from the fact that the branch was created from an older version of the trunk and the current trunk state (containing some changes from other branches) is conflicting with the changes in your current branch. You manually resolve them as it makes sense. Re-test to make sure all is still well.
UPDATE: Based on Lazy Badger's comment, your team members can put commit monitors in place to alert them when you make a change to a (particular) branch.
When we work, we do most of our code reviews after the commit takes place. None of this patch files going back and forth. We use Jenkins and have plugins that can do lot of the checking for us (like Findbugs, PMD, CheckStyle, etc.). If we find issues, we can fix them in a new commit. If the change was bad, we can revert it.
If you like your current work flow, you might want to look at Git which allows you to share patches like this very easily between developers. It's one of the reasons why Git is so popular.
I also have a Commit Monitor plugin for Subversion (a post-commit hook really) that allows people to setup their own preferences on what changes they want to be notified on. The configuration is stored inside the repository, so users have access to it.
I wish to check my changes into a different branch than the files were check out from. All the files there are the same “version” in each branch, Perforce should know this from tracking the integrations that have been done. (So no merging need to be done)
According to the Perforce Blog, the p4 move -f command will move your edit from one branch to the other. From the blog
This can be a real lifesaver if (as I did a few weeks ago) you start working on a fix in your mainline, and then decide that it needs to go into your release branch instead. Previously you would have needed to save a copy of your work, revert it, open the files in the release branch, and copy your edits back in manually — now you just “p4 move -f main/… rel/…” and all your edits go where you need them.
This is a new feature added in version 2010.1 (this year I believe) so that's probably why tech support didn't know about it.
Use "p4 move" if you have version 2009.1 or later. Just move to the new branch and revert from the old branch.
I just got an answer from support#perforce.com
You cannot check files into a branch
that they weren't checked out from.
You need to open those other files for
edit and copy your changed files over.
(I am now beginning to understand why pressure is building up from some the programmer I work with to to move to Mercurial)
Using TortoiseSVN, I need to take changes I've done in a branch and then merge them with trunk.
I am the only developer on this project, so I know trunk hasn't changed. I am learning SVN so that eventually my team can use it.
Basically, I want my trunk to look exactly like the branch.
In pre-svn world, I would just copy the files in my branch folder, delete the files in the trunk folder, and then copy branch into trunk.
In TortoiseSVN, I've tried Reintegrate a branch, Merge a range of revisions, and Merge two different trees. Nothing seems to actually change trunk. I've also tried branching on top of the trunk. This gives me an error, saying that the trunk already exists.
In your case:
Switch the working copy to the trunk (SVN Switch)
Merge the branch into the working copy (SVN Merge)
Make sure everything still compiles and works
Commit the working copy (the trunk)
Consider killing the branch
In a team environment I would suggest that you first merge the latest modifications from the trunk in your branch, make sure that everything compiles and works, then do the above steps (which will be trivial since you've already tested the changes).
Update
In step 5, I mention killing the branch. That's because once a branch from a feature is in the trunk, it should be considered as part of the trunk. In that case the branch should be killed so that no one keeps working on it. If major modifications are needed for that feature, you should create a new branch for that.
The only branches that I don't kill are maintenance and release branches, unless a particular release is no longer supported.
No matter what, you always have access to every revision so killing a branch is only used to prevent other developers from developing on a dead branch.
I think in TortoiseSVN 1.8.5, Merge | Merge two different trees should work. When you merge a branch/tag back to trunk, the trick is that the From URL is the trunk and the To is the tag/branch. Weird but true.
Source: Merging
For directories that not in your working copy but are in the tag/branch you may get conflict errors. Just accept the conflict and redo the merge.
First switch your working copy to the trunk.
Then do a merge range of revisions, from the branch to trunk.
Once this dialog is complete the differences will be pending changes in your working copy of trunk. You'll need to commit them just as if you manually made the changes on your working copy.
In my usage, its more typical to keep trunk running and spin branches off at the times of builds. So then the only merge I ever need to do is to get a bug fix out of trunk and put it on the latest build branch and re-release that branch. The easiest way for me to do this, since as you have found merging is clumsy at best. Is to keep the latest branch and the trunk checked out to my machine, and to quite literally copy the files from trunk to branch and check both in.
I am using TortoiseSVN 1.9.3, Build 27038.
Follow below steps in order to merge branch into trunk.
1) Right click on trunk working copy and select the below option.
2) In case of Branch Merging into trunk select option second as shown below and click next
3) In the From: field enter the full folder URL of the trunk. This may sound wrong, but remember that the trunk is the start point to which you want to add the branch changes.
In the To: field enter the full folder URL of the feature branch.
4) Click next and do the test merge
5) If test merge is successful then click on Merge button.
6) Once merge is successful then commit the changes on trunk.