Page 1 of 1
File versioning
Posted: Mon Mar 04, 2019 8:55 pm
by miskox
Hello!
I have a suggestion I would like you to think about it.
For example I have a source file test_file.pb.
I then change something and I press CTRL-S to save the file. And then I change something else and again I press CTRL-S.
It would be nice to have something like file versioning*.
After I would press the CTRL-S combination for the first time my original test_file.pb would be renamed to test_file.pb.1** and the new version would be saved as test_file.pb. After my second CTRL-S this current test_file.pb. would be saved as test_file.pb.2 and the new file would be named test_file.pb.
In this way I would have some backup of my work. I would just copy/rename the version that was good.
Thoughts?
Thanks.
Saso
* I worked on OpenVMS (VAX, ALPHA) for more than 20 years so I know this is very useful.
I know that PureBasic supports 'Session history'. Maybe this could be useful, too for some people. (this could be turned on/off in the settings)
** PB would scan the file system and check for the highest version number so it does not replace an existing file.
Re: File versioning
Posted: Mon Mar 04, 2019 9:02 pm
by skywalk
Try out the built-in Session History which tracks changes up to 1 month.
If that is not sufficient, then write a Tool code that triggers your flavor of Version Control.
I prefer
Fossil, which stores all changes in a single SQLite database and gives you a web page gui for timelines & diffs, email, forum, wiki, etc.
Re: File versioning
Posted: Wed Mar 06, 2019 6:12 pm
by Bitblazer
Code: Select all
on create/save file($name)
del $name.9
ren $name.8 $name.9
ren $name.7 $name.8
ren $name.6 $name.7
ren $name.5 $name.6
ren $name.4 $name.5
ren $name.3 $name.4
ren $name.2 $name.3
ren $name.1 $name.2
ren $name $name.1
save $name
iirc thats how the vms fs does it. Indeed pretty useful and very old by now (read: likely any IP right that existed, is void now). One of the "old" forgotten methods that were pretty useful - and make a lot sense for terabyte harddisks and sources (not so much for videofiles or most databases)
Re: File versioning
Posted: Wed Mar 06, 2019 10:06 pm
by Dude
skywalk wrote:Try out the built-in Session History which tracks changes up to 1 month.
It defaults to one month, but you can also disable the limit or change the duration in the Prefs. My history is set to 365 days.
Re: File versioning
Posted: Thu Mar 07, 2019 12:20 pm
by Derren
Can even be set to "Keep all history".
Good to know

Re: File versioning
Posted: Thu Mar 07, 2019 12:28 pm
by oreopa
Save as new version (filename + "_num" + ext) should be mandatory in ALL software by now.
I would also like to semi-hijack and reiterate a FR I had, that it would be great if the tokens %BUILDCOUNT and %COMPILECOUNT could be used in a filename, and they autoupdated to reflect each version saved.
I already wrote my own tools for simple source control because I dont actually find the built in session history that useful. (EDIT: however it did save my ass once, so...

)
skywalk wrote:I prefer
Fossil, which stores all changes in a single SQLite database and gives you a web page gui for timelines & diffs, email, forum, wiki, etc.
Seems like it may be useful to me soon, thx.
Re: File versioning
Posted: Fri Mar 08, 2019 3:18 am
by Tenaja
Not sure how well this will coordinate with Session History, but this is what I do for my About version display:
Code: Select all
#UpdaterThisVersion = "Beta"
Version$ = #UpdaterThisVersion
Version$ + FormatDate(".%yy.%mm.%dd.", #PB_Compiler_Date) + Str(#PB_Editor_BuildCount)
The PB constants are taken at compile time, so you can tell how many times you have compiled between saved exe's.
Re: File versioning
Posted: Fri Mar 08, 2019 5:35 pm
by Michael Vogel
What about writing an own purebasic program which will be added as a tool into the IDE?
By assigning the shortcut Ctrl+S it would be triggered to save the source code as wanted, make backups and so on - it could even modify the source code by adding a comment with the actual version number etc.
Re: File versioning
Posted: Fri Mar 08, 2019 6:25 pm
by skywalk
Well, version control is an established and optimized function that does not make sense to reattempt. It would be more efficient to develop pb tool code that would trigger check in/check out of git or fossil repositories.

Re: File versioning
Posted: Tue Mar 12, 2019 11:23 am
by miskox
Thank you all. First sorry for a late reply - I've been out of the country for a few days.
@Bitblazer: great. But the newest version should have highest version.
@tenaja: very good tips. Thanks.
Saso