Tortoise SVN 1.5: Two people checked out same files and made changes. Way to merge changes? - tortoisesvn

Two people were working on the same file at the same time unknowingly. One person committed changes to the Repo, making the second persons file out of date.
Is there a way to merge and keep both set of changes without, making the second person, move his/her file, re-update the folder to get the other persons changes, and then copy the changes he/she made into the updated file and then commit to the repo?
Thanks in advance.

Have the second user do an "Update" on his code. If they were not working with the same lines of code within the file, the Update will merge the first user's changes into the second user's code. Then the second user can just commit his code normally.
If they were working on the same lines of code, a conflict will occur and must be resolved manually, by the second user. Tortoise provides a GUI for making this manual conflict resolution a bit easier.

Related

Perforce: How to find changes made in a branch

Here's the scenario -
Development branch was created from mainline, with many thousands
of files in it
A couple of thousand files were modified.
Changes from mainline were "p4 integrated" into the branch.
Hopefully integrations always included the complete mainline as of a
known-good label, but I'm not sure of this
Steps 2 and 3 were repeated an unknown number of times - let's guess
a dozen integrates, and probably another 1000 or more changes,
usually to files already modified
I am now in the painful position of trying to code review this.
Are there any commands that can help me get the diffs for each modified file between the version last integrated to it, and the version in the branch?
Or do I need to write:
A script which will identify all locally changed files.
A script which will find the integration point for each file in the above list
Another script which will use (2) to purge the list in (1) of files with no net change
A wrapper on (2) that will issue an appropriate p4 diff2 command
FWIW, I basically know how to do this manually, file by file. It's the scale that's daunting. Also, there are changes still going into the branch, in response to code review feedback, so I'll probably be recreating my lists repeatedly.
If you know what the known-good label in the mainline was that was used to do the last integrate, this should just be:
p4 diff2 main/...#good-label dev-branch/...
since for each file "the version last integrated" will be #good-label. Files that weren't locally modified won't have any diffs, so there's no special need to filter them out.
FWIW if I were in your position I'd be making use of "p4 ichanges dev-branch/... main/..." and going through by changelist, since diffs make more sense when each is in the context of its changelist, rather than looking at one monster diff per file that each contains a dozen unrelated changes.

Tortoise SVN merging repository with working copy

I've tried searching for answers to my problem but every thread starts talking about branches and trunks and I have no idea what they're talking about.
I'm in a team of 2. We've started working on a single excel spreadsheet. I use SVN update before making my changes, however while I'm making changes, my team-mate also makes changes and commits them before I do.
I was first told that I simply have to update again before I commit and it should merge my team-mate's changes with mine. However when I update the .xlsx file, nothing seems to happen. I open up my local copy again and it isn't showing my team-mates changes. I've tried using the merge option and clicked random things in numerous attempts but nothing works. Nothing I've tried will add my team-mates changes to my working copy. Every time I compare my working copy with the repository, the changes from both of us are all highlighted, but nothing I do seems to merge them together.
The cells we modify in the spreadsheet are different ones, so we don't both make direct changes to the same cell. It should be a simple merge.
This is driving me up the wall, it keeps saying "merge successful" or "update successful" but it isn't doing anything.
.xlsx files are not text-files (they are really zip-archives), don't expect merging of such files from Subversion in any case
You can't have easy teamwork with Office's documents
First of all, xlsx files are binary rather than textual so SVN cannot merge them very well. So two of you working on one such file at the same time will not work well even if nothing goes wrong.
As for why you never saw the changes, probably you still had the file with your changes open in Excel when you did your update, and Excel never prompted to load the new changes.
To correct the immediate situation you can move your version of the file elsewhere, svn update to get the repository version back, and manually compare and resolve the differences.
In the future, since SVN is not suited well for merging this type of file, set the svn:needs-lock property on this file, and always be sure to svn lock it before editing to keep your coworkers from making changes at the same time.
If you need simultaneous editing capabilities, look into what cloud services Microsoft offers, or switch to Google Docs or similar.

How do I force Perforce to add files to changelist?

I'm a very fresh user of Perfoce, so please be patient!
I am trying to create a commit (I understand it that in Perforce it is called a changelist) of the files which have been changed. It sort of happens automatically in other VC systems, but there seems to be no easy way of doing it in p4... The problem is (maybe) that I'm not editing the files by hand, the files are generated (please don't ask me why do I have to check in the generated files...) so the whole directory tree is getting removed and then copied over with the new files. But Perforce acts as if nothing happened. In both my workspace and the depot it displays the updated files, but when someone will check them out on another machine, the files will be of the previous version.
I'm fine with doing it either through GUI or through the command line. I'd prefer the command line, because that would spare me the trouble in the long run, but it doesn't seem like it should be much hassle either way.
In other words, let's say, this is the workflow I'm used to from SVN or Git:
Run status to see what changed.
Stage / add to commit what you want to be in the next revision.
Commit and send it to the versioning server.
What I'm not able to do is the "stage" phase - because the changes are not discovered automatically.
EDIT
Ah, I think, I figured it out: reconciliation was what I needed... well, I guess if you don't marry, this word would hardly ever happen in your vocabulary :)
It appears that the proper command is reconcile. Also, as Bryan Pendleton suggested there should be status, but I must have an older version of Perforces, which doesn't have this command. This command is also available from context menu in either depot or workspace panels of Perforce graphical interface, when you click on the modified file.

How does Tortoise's non recursive commit work?

I've checked out a copy of the SVN branch (my branch) locally to which I've merged from a different branch (which has a completely different folder structure). So basically there are a lot of deletions (of old files) and additions (of new files).
When I try to commit the merge to the repository (to my branch), Tortoise says
This commit is not recursive, and there are moved/renamed folders selected for commit. Such moves/renames are always performed recursively in the repository. Do you want to commit anyway?
Is it fine to proceed with this commit? If not, what should I do so that there's no problem?
Also, for some files that I've added, I've made changes after adding (if this affects the nature).
Found by Google how to fix it: press F5 in the commit window (not in the "warning popup")
See http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2831045 for details.
On 26.08.2011 22:39, Ryan J Ollos wrote:
For several months now I've been seeing the following dialog box appear when
initiating Commit. It frequently happens when attempting to commit following
a merge.
The thing I have noticed lately however is that if I Cancel and then
manually refresh the file list (F5), I don't see the message again when
initiating the commit a second time. The commit seems to succeed fine and
with no further problems.
The commit dialog monitors the working copy in a background thread for
change notifications. Such notifications are sent by the OS in case
files are modified/moved/renamed/...
If such a notification is received, the commit dialog first does a few
checks so it can drop most of them. If the notification indicates that a
file that is not checked and not visible in the commit dialog has
somehow changed, it switches back to non-recursive committing.
That's because if you have e.g. a file open in another editor and save
your changes while the commit dialog is open, then that file would get
committed as well even though you haven't checked it in the commit
dialog (it doesn't show up until you refresh the dialog with F5).
So if you see that warning dialog often, please check if there's another
tool/app running which modifies files in your working copy.
And as you noticed: if you hit F5, that 'non-recursive flag' is reset
because after a refresh, you see all the files again - even the ones you
modified after you started the dialog.
Stefan
I had the same issue but resolved it by reverting changes to files that I had marked to 'ignore-on-commit'
Once I reverted these files, then tortoisesvn was able to commit all the other files from the merge
Is it fine if i proceed with this commit?
No, your commit will ignore all changes in WC-tree and reflect only root-level changes (broken merge).
You made an error when checking out non-recursive initially. You can try to perform good, full commit using --depth infinity parameter in the CLI or find this switch in TortoiseSVN GUI.
svn commit --depth infinity . -m "Merge"
Also for some files that I've SVN-added , I've made changes after adding (If this affects the nature).
In my case that was exactly what caused the message to appear, even I unselected those files for the commit.
Ugly solution which only works safely if just a few files are affected:
Create a copy of the changed files
Revert the changed files
Commit the merge/reintegration
Copy the changed files back to the original place
Reminder to self: only reintegrate a branch if the target (trunk) is clean.
I just had the same issue. Instead of selecting all the files, I clicked on versioned and everything worked well. In my case, the option versioned selected all the files, so everything is ok now.
It looks like TortoiseSVN performs some kind of validity checking before calling commit. Good but the error message is very unclear.
When I faced this issue, I went back to using the svn command line to commit. Commit failed due to the reason that one of the folders was not up to date. After updating just that folder, I ran "svn commit" once again and it went through.
Edit: PS: Before you use try this out, make sure you do not have any files marked as "ignore on commit". "Ignore on commit" is tortoise specific and SVN commit picks these changes as well.
Just thought I'd post this because it worked for me...
The reason this happened is because I'd partially renamed one of the new projects I'd created and for some reason they all showed up as "Missing" on the commit screen.
After I removed the project and folder (which SVN had put a tick on) and put it back in as a new project again, suddenly all of the "Missing" had turned into "Added" and the commit ran fine without warning me of anything.
Hope this helps!
I saw this issue and the cause was a few added files not having the added status for no apparent reason. They were 'normal' even though the parent folder correctly showed as 'added'. I reverted those 'normal' changes and then manually re-did them. This made each added item show up twice in the commit list but it resolved the error and everything appears to be in working order now.
It didn't have anything to do with ignore-on-commit as in another answer, it just seemed like a bug in TortoiseSVN.
The problem could be, that your mergeinfo is deleted by someone or automatically, because the infos moved up in the tree. If you are gonna merge them in again, it will work for the moment. But all others will get problems with their not merged branches. SVN will loose some code and merge already submitted code again.
So reverting those files and changing them again could work, but you should not just commit the changes.
i don't know a option for tortoisesvn but u could use the command line
svn commit --non-recursive [folder]
thats sould work just as u like it to work
greeings

Why did my tortoise svn merge a file and not conflict it?

I changed a file locally and then I updated the repository and someone else had updated the file. However Instead of a conflict coming up and me having to go in and diff the file and select which portions from which file to use it looks like tortoise svn just merged the file instead...
That just means everything went well.
You get a conflict only when your versioning tool (svn) can't merge the two versions of a file properly.
Without knowing the details I can only guess, but if your changes wasn't in conflict with the other persons changes, then Subversion will happily merge without producing a conflict.
As a test, try adding a file with 10 numbered lines, branch it, then in one branch change the first line and in the other branch change the last line, then attempt the merge and you should observe the same happening again.
If the changes are overlapping or close to each other, you'll get merge conflicts.

Resources