Recent

Author Topic: Code history  (Read 4006 times)

tr_escape

  • Sr. Member
  • ****
  • Posts: 399
  • sector name toys | respect to spectre
    • Github:
Code history
« on: October 05, 2015, 02:22:22 pm »
Hello everyone,

All we are typing a lot of lines in our project and some times we adding some codes / functions in hurry.
When coding in hurry can be forget our code details like as "when I created this function".

Is it possible to keep a history of the code of the project?

Delphi has got some options but it saves last 10 builds but I want to see daily changes of project.

Like as:


Code: Pascal  [Select]
  1.   TForm1 = class(TForm)
  2.   private
  3.     { private declarations }
  4.   public
  5.     { public declarations }
  6.     function getvals(s:string):string;  // 05.10.2015  --> it can be add when I press ctrl+shift+c
  7.   end;
  8. .
  9. .
  10. .
  11. function TForm1.getvals(s: string): string; // 05.10.2015
  12. begin
  13.   result := '';
  14. end;
  15.  
  16.  


When I changed that code on an other day:

Code: Pascal  [Select]
  1.   TForm1 = class(TForm)
  2.   private
  3.     { private declarations }
  4.   public
  5.     { public declarations }
  6.     function getvals(s:string;n:integer):string;  // 05.10.2015,06.10.2015 --> it can be add when I press ctrl+shift+c again
  7.   end;
  8. .
  9. .
  10. .
  11. function TForm1.getvals(s: string;n:integer): string; // 05.10.2015,,06.10.2015
  12. begin
  13.   result := '';
  14. end;
  15.  
  16.  

It is just an idea about code managing of Lazarus.

Have a nice coding.

GetMem

  • Hero Member
  • *****
  • Posts: 3507
Re: Code history
« Reply #1 on: October 05, 2015, 02:58:34 pm »
Put your project under version control.

shobits1

  • Sr. Member
  • ****
  • Posts: 278
  • .
Re: Code history
« Reply #2 on: October 05, 2015, 08:30:27 pm »
I thinks he wants, an svn integration in lazarus, which is good idea -I guess-  :)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5695
    • wiki
Re: Code history
« Reply #3 on: October 05, 2015, 10:50:28 pm »
When coding in hurry can be forget our code details like as "when I created this function".
Never code in a hurry....

Lazarus also does backups, and you can set hew many and where (explore the options).
However since the project is saved for each compile, that does afaik each time create a backup.

As already suggested version control. (git/svn). Really good, but you must remember to commit regularly.

Other options.

Define a "code template" (option menu) to create the new function. (and a 2nd for procedure)
Code: [Select]
function $param(Name)($param( )): $param(Type); // $Date()
you can assign it to enter the word(part) func, then hit ctrl-j

Your new function should have a date.


You can play with editor macros/pascalscript too, but that is a long shot.
You can intercept the ctrl-shift-c, by reassigning it to a macro, and then the macro calls the original function (and does whatever else)