Recent

Author Topic: How does Backup work?  (Read 2013 times)

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
How does Backup work?
« on: November 18, 2019, 02:55:58 pm »
Lazarus 2.0.4
I have never before looked in the "Backup" folder that Lazarus creates, but on a whim, this morning I thought I'd see what it does.

I recorded all the file dates in there and then loaded Lazarus and made some changes to 2 files of a Project that had files listed in Backups.

The Main Form changes were largely superficial, I changed some COMMENT lines and shuffled the order of commands within a "Clear" procedure. Nothing I did would have changed the working of the Project. The other file I broke a large Function into 2 smaller ones. I then changed all the calls to the original single Function to point to the 2 new ones.

I compiled and ran the Project, then closed Lazarus.

The Main Form with superficial changes was not backed up, but the other Form with the major changes was.

Is there a Setting somewhere to make it include all changed files? This is important as the changes I made to the Main Form included some history comments of the changes I was about to make to the Form with the significant changes.
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: How does Backup work?
« Reply #1 on: November 18, 2019, 03:13:43 pm »
Afaik (!) whenever any file is saved, the existing file (which is about to be overwritten) will be copied to the backup folder.

When you compile, all changed files should be saved, triggering the above.

--
If you need more sophisticated backup consider a repository. You may for example setup a local git repro. Though you need to trigger each commit yourself. (or maybe you can setup a "before compile" task.

devEric69

  • Hero Member
  • *****
  • Posts: 648
Re: How does Backup work?
« Reply #2 on: November 18, 2019, 03:25:25 pm »
Indeed, for the moment, there are only three options:
- the undo \ redo stack.
- the \Backup directory.
- to install Git or TortoiseSVN or RabbitSVN (which I strongly recommend, if you want to trace, and keep track, of a significant and important history for yourself).
« Last Edit: November 18, 2019, 03:28:25 pm by devEric69 »
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How does Backup work?
« Reply #3 on: November 18, 2019, 04:31:55 pm »
Hi!

If you want to save the whole backup history in your  lazarus backup directory then set in the backup option

* Type of backup to counter (2 times)
* The maximum count to infinity (2 times)

And admire how often you did press Ctrl-S

Winni

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
Re: How does Backup work?
« Reply #4 on: November 19, 2019, 07:10:08 pm »
When you compile, all changed files should be saved, triggering the above.

Thanks, I do not need more than the Lazarus Backup folder as I do daily overall backups. I just needed to look at something older without having to go to the main system backup for the previous day.

But, it appears the "should" is the operative here, but it ain't. :)

It seems to decide on the degree (byte-count -- maybe?) of change.
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: How does Backup work?
« Reply #5 on: November 19, 2019, 07:38:25 pm »
Hi!

If you leave the backup options untouched, then you only have the last version of your files. If you save a .pas  or lfm there will be only the last version be backuped. If you need the version of yesterday or one week ago then you should take the described option with the counter.

Winni
« Last Edit: November 19, 2019, 07:46:47 pm by winni »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: How does Backup work?
« Reply #6 on: November 19, 2019, 08:52:30 pm »
Well I did not design it, so I do not know what it indent it. I would definetely not expect any "bytecount" rules or the like.... That would seem buggy to me.

If you have clear steps to reproduce, you can always report it. If it is not a bug, then it may be a feature request, or get closed.

 

TinyPortal © 2005-2018