Same version of IDE reorders file contents on 2 different saves

I’ve now gotten my primary projects updated to 2022r1.1. However, I’m running into issues when trying to merge versions where the order in which code sections - Begin … End - are not being saved consistently between edit sessions. For instance, I save a version of my work, check it in to SVN, and shutdown for the evening. I start back up in the morning, add a new label or other object, resave the same project, and end up with conflicts because an unchanged object is now located 30 sections lower in the code than the previous save.

Is nothing done to maintain the file order in text projects between saves?

I don’t think I’ve ever seen what you’re describing unless something about the item changes. Are you sure you didn’t rename the control?

I see this. We use XML and SVN. Makes code compare almost useless.

This is a massive issue. Every version of Xojo I have seen reorders the code the the saved file. I use mainly XML so I can compare code versions. Also, Modules saved externally get their ObjContainerID in the xojo_xml_code file changed randomly when building. There are many modules that dont get touched but SVN sees a file change. Hard to keep track of actual changes or just an ID change

Isn’t the load and save… slow ? (time consuming ?)

Why don’t you use the text (Xojo) format (with SVN) ?

I don’t see this, and I don’t use XML. I use the text format. For version comparison, I’m using Cornerstone v2.7.18, which uses svn internally.

Positive. In one example, my pmVerifySourceDrive PopupMenu begins at line 382 in the original save but at line 3840 in the second save. None of the event code in that control was touched between the two saves.

I also have Cornerstone and I normally just need to do a Sync merge. This issue results in my needing to use Cherry Pick mode. If I create a patch diff (diff -Naur), it results in 4,820 lines instead of the expected 121 that were actually changed and added.

I haven’t created patch diff files in a long time, but what I do remember is that if you move 121 lines of code from one place to another compared to the same file (different version with the code in a different place) then the patch file will only create an add section to the new position and a remove section for the old position.

Could the diff -Naur be changed to only create this type of patch?

You said ‘shutdown for the evening’, does that mean that you closed Xojo and opened it the next morning?

When I said I mainly use the xml format I was talking about xojo_xml_project. If you diff 2 files…on some builds code blocks can be jumbled. The xojo_project format is impossible with a versioning system as it creates new files for modules and classes etc. You would have to remember to add those to the repository every new one you added. What do you mean by text format?

Other than an unknown bug, the reason things can move vast distances in the source is one of two reasons:

  1. You change the ordering of the control (front, back etc)
  2. You change the parent of the control

The controls are saved in the order they are at design time. Move it to the back and it goes to the top of the file above all other controls, to the front and it will move to the end of the file. If you move a control into a parent it will appear in order under that parent control so it can quite easily move from the top of the file to the bottom with the smallest of changes at design time.

Ideally each control would have a unique ID which which never change and so it stays in the same place in the file, if the position of the control is moved then its ID is moved up or down a few lines instead of the huge control block.

1 Like

Im going to make a test project. I have reported it to issues
https://tracker.xojo.com/xojoinc/xojo/-/issues/69516

I think external modules are a problem. Their container ids update randomly when building

No. Xojo saves lots of changes even if the class or window hasn’t been touched at all.

1 Like

I mean the Xojo_project format. If I add a new class/module etc, then Cornerstone asks me what I want to do with this unversioned file. I just choose “Add to working set” and continue.

I don’t seem to see much of that these days.

Only on mac. Not interested in buying another project/plugin/app. Xojo should think about including svn and git natively

Well even for macOS you can’t buy that version of Cornerstone now. Ownership changed and they’ve gone to a subscription model for a subsequent version, so I’ve not bothered upgrading. At least it became 64-bit before that happened.

SVN/Git is not Xojo’s core business. Wait until you lost your first code.

Was just saying it would be great if integrated. That way if you used xojo project then xojo could auto add files into the repository. Xojo project creates separate files for each module, class, etc and you have to remember to add it. I use SVN

You need a bit of software that tells you to add them - like Cornerstone does.