Bug 6416 - Reverting changes in Changes tab can mangle code
Summary: Reverting changes in Changes tab can mangle code
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Version Control ()
Version: unspecified
Hardware: PC Linux
: High normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-08-06 09:05 UTC by Peter Hultqvist
Modified: 2012-10-10 02:25 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Peter Hultqvist 2012-08-06 09:05:30 UTC
This applies to a single open .cs file within a git-version controlled project.

The original code looks like this:
		
		public Read (BinaryReader r)
		{
			Z = r.ReadInt32 ();
			D = r.ReadInt16 ();
		}

Then I go to the Changes bottom tab and show the diff between an old revision and Local, so far all looks good.
I can there revert single groups of lines and it looks as expected.
When I go back to the Source bottom tab I expect the code as shown/modified in the Local side to be the one presented.
Instead I sometimes get a mangled result:

		public Read (BinaryReader r)
		{
			Z = r.ReadInt3          D = r.ReadInt16 ();
e ();
		}

To generate the test case above I went to the Changes tab. The right column was always Local.
The left one I changed to a previous revision, there I reverted some changes.
Then I changed the left side to Base and reverted those new changes so I should get back to Base=Local.
Instead I get the result as presented above.

Note that the mangled code appears first when I go to the Source tab, before that it all looks as expected.

This does not happen for all cases but for those it does it can be repeated with the same problem every time.

MonoDevelop 3.1.0
Installation UUID: 73a4bf08-b840-4d16-8615-5a09b9a8b2e9
Runtime:
	Mono 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2) (64-bit)
	GTK 2.24.10
	GTK# (2.12.0.0)
Build information:
	Git revision: e91815bad0d6504535a7ef4aeea1ced80239532e
	Build date: 2012-08-06 12:08:23+0000
Operating System:
	Linux
	Linux purple 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Peter Hultqvist 2012-08-06 09:07:27 UTC
I simplified the code sample, there was an extra line in the end of the function:

r.ReadByte ();

Which could be from where the last "e ();" came from.
Comment 3 Mike Krüger 2012-10-10 02:25:46 UTC
I've reviewed the code & found a potential issue - reopen, if it happens again.
(MD 3.0 / ui refresh branch)