Recent

Author Topic: "TestAll" project issues  (Read 5408 times)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
"TestAll" project issues
« on: December 10, 2022, 08:21:40 pm »
This Aruna's quote is copied from the "Bugs in Example Projects window" thread.

I ran git blame examples/testall.lpi and below is what is of interest to us.
Code: Text  [Select][+][-]
  1. 87791326d0d (bart     2016-03-04 15:05:52 +0000  87)     <SearchPaths>
  2. 87791326d0d (bart     2016-03-04 15:05:52 +0000  88)       <IncludeFiles Value="$(ProjOutDir)"/>
  3. 5328b9a852b (juha     2019-05-06 11:32:58 +0000  89)       <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
  4. 87791326d0d (bart     2016-03-04 15:05:52 +0000  90)     </SearchPaths>
  5.  

In 2019 Juha added  <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> this works for windows but does not work for Linux
as seen by the error message below.
git blame shows who touched a certain line last. It does not show further history nor the diff of the commits mentioned. For that you need another tool like gitk.
Commit 5328b9a852b is from 2019-05-06. Here is the diff :
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="10"/>
+    <Version Value="12"/>
     <General>
+      <Flags>
+        <CompatibilityMode Value="True"/>
+      </Flags>
       <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
       <Title Value="testall"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
@@ -47,9 +49,10 @@
       <Version Value="2"/>
     </PublishOptions>
     <RunParams>
-      <local>
-        <FormatVersion Value="1"/>
-      </local>
+      <FormatVersion Value="2"/>
+      <Modes Count="1">
+        <Mode0 Name="default"/>
+      </Modes>
     </RunParams>
     <RequiredPackages Count="1">
       <Item1>
@@ -83,7 +86,7 @@
     </Target>
     <SearchPaths>
       <IncludeFiles Value="$(ProjOutDir)"/>
-      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>
     <CodeGeneration>
       <Checks>

There is a related commit 337b198136 from 2020-12-11. Its diff :
Code: [Select]
@@ -21,7 +21,7 @@
           </Target>
           <SearchPaths>
             <IncludeFiles Value="$(ProjOutDir)"/>
-            <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+            <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
           </SearchPaths>
           <CodeGeneration>
             <Optimizations>

As you can see I fixed the path delimiters so that they work also on Linux and Unix systems.

Quote
Code: Text  [Select][+][-]
  1. Unable to write state file for project Project
  2. Error: Unable to create file "/home/aruna/lazarus/examples/lib\x86_64-linux/testall.compiled": No such file or directory
  3.  
The path is all that needs to be fixed so I changed the '\' backslash after /home/aruna/lazarus/examples/lib\ to a forward slash and now it works on linux. My question to you all is the testall.lpi file contents are in XML format so how do I do something like {$ifdef linux} in a XML file for christ sake  ::) OR as is usual in my case I am missing something  obvious?
'/' in path settings works also on Windows. The IDE at some point converts it to '\' for Windows. No need for {$ifdef linux} in XML.
Why you have '\' there? I don't know.
Maybe you checked out (git checkout) a revision earlier than commit 337b198136.
Maybe you have local changes after you played with the commit history. Then do "git reset --hard" but be careful with it. You may lose changes you wanted to keep.
I assume you have the "main" branch active.
« Last Edit: December 10, 2022, 08:26:08 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" project issues
« Reply #1 on: December 11, 2022, 04:49:17 am »
As you can see I fixed the path delimiters so that they work also on Linux and Unix systems.
Yes I saw that after I had sent out my email.

'/' in path settings works also on Windows. The IDE at some point converts it to '\' for Windows. No need for {$ifdef linux} in XML.
[EDIT] No wonder... I want to see how and where the IDE is converting this I was quite perplexed when it did work fine on both windows and my linux. Now I know the reason haha  :)

Why you have '\' there? I don't know.
Initially because I had checked out a branch which did not have your fix and now because 'I' went and changed it to trigger the error. It is all good now. Thank you. Sorry for causing any confusion.

Maybe you checked out (git checkout) a revision earlier than commit 337b198136.
Yes that was why.

Maybe you have local changes after you played with the commit history. Then do "git reset --hard" but be careful with it. You may lose changes you wanted to keep.
I assume you have the "main" branch active.
The main branch I check out when I need to but I am mostly on fixes_2_2 because that is the branch that has the other examples that need work.
« Last Edit: December 11, 2022, 05:09:28 am by Aruna »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: "TestAll" project issues
« Reply #2 on: December 11, 2022, 09:48:31 am »
Quote
The main branch I check out when I need to but I am mostly on fixes_2_2 because that is the branch that has the other examples that need work.
You mean the examples that were deleted from "main"? The examples that were not deleted, were moved to another directory and can still be found in "main".
The ones that were deleted, may have been changed in "main" before the deletion. "fixes_2_2" branch does not have those changes.
At least "TestAll" was changed in "main".
Instead of working with "fixes_2_2" you should go to a "main" revision just before the deletion, then copy the examples you need somewhere and then return to "main" HEAD.
Later create a local feature branch for your own changes. That branch can be rebased against "main" from time to time.

The deletion happened in revision 31328882fb8d3acace
Date: 05/03/2022
Message: Example projects tested, categorised, metadata added, restructured by David Bannon.

The revision before that is 4030fcc52c936a, dealing with Codetools.
Do "git checkout 4030fcc52c936a", then copy the files.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: "TestAll" project issues
« Reply #3 on: December 11, 2022, 11:28:12 am »
I want to see how and where the IDE is converting this I was quite perplexed when it did work fine on both windows and my linux. Now I know the reason haha  :)
Unit LazFileUtils has function SwitchPathDelims(). Search for it in all Lazarus sources, whole words only. You should get 52 matches. Study the code that calls it.
'\' path delimiter is processed also in some other functions.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: "TestAll" project issues
« Reply #4 on: December 22, 2022, 08:59:01 am »
This Aruna's question was in "Bugs in Example Projects window" thread. I reply it here.

I just moved all 'testall' files to lcl/tests in branch fixes_2_2 on my local repository and pushed to my remote everything went well. Now when I try to create a merge request gitlab starts complaining please see attached screenshot.
Don't use fixes_2_2 branch when you participate in the development process. You must use the "main" branch.
Some bug fix commits are then backported to fixes_2_2 but everything goes to "main" first.

The Lazarus development version is very usable most of the time. You should consider using it exclusively unless you maintain some customer application which requires max stability.
For example I play only with the "main" development version because I don't have such projects to maintain now.

So I have to
- fork the Lazarus Repo, then..
- clone the fork to my local system, then..
- somehow get the local repo to fetch/pull from the original Lazarus main/trunk.
You can skip the GitLab merge request process if you don't like it. Patches are still supported.
Work with your changes in a local feature branch ("git switch -c myfeature") and "git rebase main" it sometimes.
Create patch(es) with "git format-patch main" while your feature branch is active. The rebasing guarantees there will be no merge conflicts when it is applied. Upload the patch to an issue report or somewhere.

For the TestAll project you don't need to create a patch. For the revision control those files are new, thus the diff format is not needed.
Just upload the files here in forum post or in mailing list post or in issue tracker as a .zip or .tgz package or similar. First make sure it compiles and works with latest "main".

I don't know well the GitHub and GitLab processes either. I used Git locally for Lazarus development already when it was in a SVN server, by using a git-svn link. It worked very well and I had a real Git repository locally with all its goodies.
Now I mostly synchronize with the server with "git pull" and "git push" using the default "main" branch. Super easy. I guess I should learn to work with remote branches better.

P.S.
Quote
Since I started working again time has become a very limited commodity for my personal projects.
Do you also work with carrots? Or some other vegetables maybe?  ;)
« Last Edit: December 22, 2022, 09:09:28 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" project issues
« Reply #5 on: December 28, 2022, 03:34:39 am »
@JuhaManninen and @dbanon I tried everything and am still unable to 'sync' the Lazarus/main repository with my own fork. I have given the bash output at each stage and if someone can figure out a fix it would be most welcome. Else I am simply going to delete my fork and start from scratch.

I have been struggling with this over a week now :-( Please see below for details.

I created a remote 'personal' which is my forked repository and a 'upstream' which is lazarus/main.

Code: Bash  [Select][+][-]
  1. aruna@debian:/media/aruna/linux-next/lazarus$ git remote -v
  2. personal        https://gitlab.com/aruna.hewapathirane/lazarus.git (fetch)
  3. personal        https://gitlab.com/aruna.hewapathirane/lazarus.git (push)
  4. upstream        https://gitlab.com/freepascal.org/lazarus/lazarus.git (fetch)
  5. upstream        https://gitlab.com/freepascal.org/lazarus/lazarus.git (push)
  6.  

git status tells me my branch is behind by 24 commits.

Code: Bash  [Select][+][-]
  1. aruna@debian:/media/aruna/linux-next/lazarus$ git status
  2. On branch main
  3. Your branch is behind 'upstream/main' by 24 commits, and can be fast-forwarded.
  4.   (use "git pull" to update your local branch)
  5.  
  6. nothing to commit, working tree clean
  7.  

I do a git pull upstream

Code: Bash  [Select][+][-]
  1. aruna@debian:/media/aruna/linux-next/lazarus$ git pull upstream
  2. Updating fe6b88d8da..0f438c98fe
  3. Fast-forward
  4.  components/buildintf/projectintf.pas                             |   4 +-
  5.  components/codetools/finddeclarationtool.pas                     |  38 ++++++++++++------
  6.  components/ideintf/objectinspector.pp                            |   2 +-
  7.  components/jcf2/IdePlugin/lazarus/jcfuiconsts.pas                |   2 +-
  8.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.cs.po    |   2 +-
  9.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.de.po    |   4 +-
  10.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.es.po    |   2 +-
  11.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.fr.po    |   4 +-
  12.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.hu.po    |   4 +-
  13.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.it.po    |   4 +-
  14.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ja.po    |   4 +-
  15.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.lt.po    |   4 +-
  16.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pl.po    |   2 +-
  17.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pot      |   2 +-
  18.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pt_BR.po |   4 +-
  19.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ru.po    |   6 +--
  20.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.uk.po    |   4 +-
  21.  components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.zh_CN.po |   2 +-
  22.  components/jcf2/Parse/BuildParseTree.pas                         |   2 +-
  23.  components/jcf2/Process/Indent/Indenter.pas                      |  11 ++++-
  24.  components/jcf2/Process/Transform/SortUsesData.pas               |   4 +-
  25.  components/lazcontrols/docs/listfilteredit.xml                   |  68 +++++++++++++++++--------------
  26.  components/lazcontrols/docs/listviewfilteredit.xml               |  39 +++++++++++++++---
  27.  components/lazcontrols/docs/treefilteredit.xml                   |  52 ++++++++++++++++++++----
  28.  components/lazcontrols/listfilteredit.pas                        |   2 +-
  29.  components/lazcontrols/listviewfilteredit.pas                    |  12 +++++-
  30.  components/lazcontrols/treefilteredit.pas                        |   5 ++-
  31.  components/lazreport/source/fr3tolrf.pas                         |   2 +-
  32.  components/virtualtreeview/laz.virtualtrees.pas                  |   8 ----
  33.  docs/xml/lcl/comctrls.xml                                        |  40 ++++++++++++++----
  34.  docs/xml/lcl/editbtn.xml                                         | 107 +++++++++++++++++++++++++++++++++++++------------
  35.  docs/xml/lcl/printers.xml                                        |   2 -
  36.  examples/filteredits/filteredits.ex-meta                         |   5 +++
  37.  examples/filteredits/filtereditsdemo.ico                         | Bin 0 -> 133345 bytes
  38.  examples/filteredits/filtereditsdemo.lpi                         |  95 +++++++++++++++++++++++++++++++++++++++++++
  39.  examples/filteredits/filtereditsdemo.lpr                         |  28 +++++++++++++
  40.  examples/filteredits/filtereditsdemo.res                         | Bin 0 -> 135460 bytes
  41.  examples/filteredits/listfilterunit.lfm                          |  23 +++++++++++
  42.  examples/filteredits/listfilterunit.pas                          |  50 +++++++++++++++++++++++
  43.  examples/filteredits/listviewfilterunit.lfm                      | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  44.  examples/filteredits/listviewfilterunit.pas                      | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  45.  examples/filteredits/mainunit.lfm                                |  51 +++++++++++++++++++++++
  46.  examples/filteredits/mainunit.pas                                |  85 +++++++++++++++++++++++++++++++++++++++
  47.  examples/filteredits/treefilterunit.lfm                          |  23 +++++++++++
  48.  examples/filteredits/treefilterunit.pas                          |  50 +++++++++++++++++++++++
  49.  ide/componentlist.pas                                            |   1 -
  50.  ide/editorfilemanager.pas                                        |   1 -
  51.  ide/frames/editor_keymapping_options.pas                         |   3 +-
  52.  ide/projectinspector.pas                                         |   2 -
  53.  ide/searchresultview.pp                                          |   3 +-
  54.  ide/viewunit_dlg.pp                                              |   1 -
  55.  lcl/editbtn.pas                                                  |  57 ++++++++++++++++++--------
  56.  lcl/grids.pas                                                    |   8 ----
  57.  lcl/include/wincontrol.inc                                       |   6 ++-
  58.  lcl/interfaces/qt5/cbindings/Qt5Pas.pro                          |  11 +++--
  59.  lcl/interfaces/qt5/cbindings/src/chandles.h                      |   3 ++
  60.  lcl/interfaces/qt5/cbindings/src/pascalbind.h                    |   2 +
  61.  lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook.h       |  87 ++++++++++++++++++++++++++++++++++++++++
  62.  lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook_c.cpp   |  36 +++++++++++++++++
  63.  lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook_c.h     |  23 +++++++++++
  64.  lcl/interfaces/qt5/qt56.pas                                      |   9 +++++
  65.  lcl/interfaces/qt6/cbindings/Qt6Pas.pro                          |  13 +++---
  66.  lcl/interfaces/qt6/cbindings/src/chandles.h                      |   3 ++
  67.  lcl/interfaces/qt6/cbindings/src/pascalbind.h                    |   2 +
  68.  lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook.h       |  87 ++++++++++++++++++++++++++++++++++++++++
  69.  lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook_c.cpp   |  36 +++++++++++++++++
  70.  lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook_c.h     |  23 +++++++++++
  71.  lcl/interfaces/qt6/qt62.pas                                      |  10 +++++
  72.  lcl/lcltype.pp                                                   |   5 +++
  73.  packager/installpkgsetdlg.pas                                    |   4 +-
  74.  packager/packageeditor.pas                                       |  22 +++++-----
  75.  tools/runwait.sh                                                 |   7 +++-
  76.  72 files changed, 1386 insertions(+), 190 deletions(-)
  77.  create mode 100644 examples/filteredits/filteredits.ex-meta
  78.  create mode 100644 examples/filteredits/filtereditsdemo.ico
  79.  create mode 100644 examples/filteredits/filtereditsdemo.lpi
  80.  create mode 100644 examples/filteredits/filtereditsdemo.lpr
  81.  create mode 100644 examples/filteredits/filtereditsdemo.res
  82.  create mode 100644 examples/filteredits/listfilterunit.lfm
  83.  create mode 100644 examples/filteredits/listfilterunit.pas
  84.  create mode 100644 examples/filteredits/listviewfilterunit.lfm
  85.  create mode 100644 examples/filteredits/listviewfilterunit.pas
  86.  create mode 100644 examples/filteredits/mainunit.lfm
  87.  create mode 100644 examples/filteredits/mainunit.pas
  88.  create mode 100644 examples/filteredits/treefilterunit.lfm
  89.  create mode 100644 examples/filteredits/treefilterunit.pas
  90.  create mode 100644 lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook.h
  91.  create mode 100644 lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook_c.cpp
  92.  create mode 100644 lcl/interfaces/qt5/cbindings/src/qnativeeventfilter_hook_c.h
  93.  create mode 100644 lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook.h
  94.  create mode 100644 lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook_c.cpp
  95.  create mode 100644 lcl/interfaces/qt6/cbindings/src/qnativeeventfilter_hook_c.h
  96.  

Now git status says my branch is uptodate.

Code: Bash  [Select][+][-]
  1. aruna@debian:/media/aruna/linux-next/lazarus$ git status
  2. On branch main
  3. Your branch is up to date with 'upstream/main'.
  4.  
  5. nothing to commit, working tree clean

So I try to push what I just pulled to my remote 'personal' and nothing but grief. I need HELP!
Code: Bash  [Select][+][-]
  1. aruna@debian:/media/aruna/linux-next/lazarus$ git push personal
  2. Username for 'https://gitlab.com': Aruna.Hewapathirane
  3. Password for 'https://Aruna.Hewapathirane@gitlab.com':
  4. To https://gitlab.com/aruna.hewapathirane/lazarus.git
  5.  ! [rejected]              main -> main (non-fast-forward)
  6. error: failed to push some refs to 'https://gitlab.com/aruna.hewapathirane/lazarus.git'
  7. hint: Updates were rejected because the tip of your current branch is behind
  8. hint: its remote counterpart. Integrate the remote changes (e.g.
  9. hint: 'git pull ...') before pushing again.
  10. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  11. aruna@debian:/media/aruna/linux-next/lazarus$
  12.  
« Last Edit: December 28, 2022, 03:43:57 am by Aruna »

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" project issues
« Reply #6 on: December 28, 2022, 03:46:49 am »
Do you also work with carrots? Or some other vegetables maybe?  ;)
I have tried to grow my own vegetables but I live in a condominium apartment so it has had limited success. I do not have land to plant on. I have to use small pots or bottles along the living room window so they get some sunlight. I am not sure if this will work but here are some pictures of my attempts at growing herbs.
« Last Edit: December 28, 2022, 11:32:33 am by Aruna »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: "TestAll" project issues
« Reply #7 on: December 28, 2022, 04:14:17 am »
@JuhaManninen and @dbanon I tried everything and am still unable to 'sync' the Lazarus/main repository with my own fork. I have given the bash output at each stage and if someone can figure out a fix it would be most welcome. Else I am simply going to delete my fork and start from scratch.

I have been struggling with this over a week now :-( Please see below for details.

I created a remote 'personal' which is my forked repository and a 'upstream' which is lazarus/main.

You haven't done a "git pull personal".


If you look at the "git log --oneline --graph --all" then you should see
 (or "git log --oneline --graph -n 50 main upstream/main personal/main")
1) main (your local branch / the tip of your local branch)
2) upstream/main (the tip of the main branch in the lazarus repo)
3) personal/main (the tip of the main branch in your fork)

the local "main" must be above the personal/main.

And there must be a line down connecting them.
So personal/main is on a commit that is included in local main.

If they are (the error does NOT suggest) on different lines, then they have "diverged".
But this should only be possible if you made your own commits to main and pushed that to personal/main.
(to avoid that, always make your own commits on new branches)


« Last Edit: December 28, 2022, 04:16:20 am by Martin_fr »

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" project issues
« Reply #8 on: December 28, 2022, 11:18:38 am »

If you look at the "git log --oneline --graph --all" then you should see
 (or "git log --oneline --graph -n 50 main upstream/main personal/main")
)

Hello @Martin_fr thank you very much for taking the time to explain but this is way over my head right now. Hopefully with time I will begin to understand how git does things.
I ran git reflog. Bash output Is below. You may be able to see where I went wrong? Please do not ask me why I did whatever it is I did I was experimenting is my only reason for
all this.

[/quote]
Code: Bash  [Select][+][-]
  1.  
  2. 0f438c98fe HEAD@{0}: pull upstream: Fast-forward
  3. fe6b88d8da HEAD@{1}: reset: moving to fe6b88d8da
  4. dd428486b0 HEAD@{2}: reset: moving to dd428486b0
  5. 0f438c98fe HEAD@{3}: reset: moving to HEAD
  6. 0f438c98fe HEAD@{4}: pull upstream: Fast-forward
  7. 5f76b3e31c HEAD@{5}: pull: Fast-forward
  8. fe6b88d8da HEAD@{6}: checkout: moving from fixes_2_2 to main
  9. fe6b88d8da HEAD@{7}: checkout: moving from cfe290a58bea764f8246399038407a3af3dccae8 to fixes_2_2
  10. cfe290a58b HEAD@{8}: rebase (pick): Delete Laz_Hello.lpi
  11. 858d0032ce HEAD@{9}: rebase (pick): Upload New File
  12. 92f578a52c HEAD@{10}: rebase (pick): Upload New File
  13. ff9d3bdfba HEAD@{11}: rebase (pick): Upload New File
  14. f9610dee62 HEAD@{12}: rebase (pick): Upload New File
  15. 471e177452 HEAD@{13}: rebase (pick): Upload New File
  16. c02bf01597 HEAD@{14}: rebase (pick): Upload New File
  17. 83f083fa3e HEAD@{15}: rebase (pick): Upload New File
  18. cbe7cd4092 HEAD@{16}: rebase (pick): Upload New File
  19. 338d6ffa60 HEAD@{17}: rebase (pick): Upload New File
  20. 5050e1f5ae HEAD@{18}: rebase (pick): Add new directory
  21. 2eafc5a18d HEAD@{19}: rebase (pick): Add new directory
  22. fe6b88d8da HEAD@{20}: rebase (start): checkout main
  23. dd428486b0 HEAD@{21}: checkout: moving from c06424ac85213ff461ecaca210b62cc2fe868382 to personal/main
  24. c06424ac85 HEAD@{22}: checkout: moving from main to personal/fixes_2_2
  25. fe6b88d8da HEAD@{23}: checkout: moving from fixes_2_2 to main
  26. fe6b88d8da HEAD@{24}: checkout: moving from main to fixes_2_2
  27. fe6b88d8da HEAD@{25}: pull: Fast-forward
  28. d7e3d2231f HEAD@{26}: checkout: moving from c06424ac85213ff461ecaca210b62cc2fe868382 to main
  29. c06424ac85 HEAD@{27}: checkout: moving from main to remotes/personal/fixes_2_2
  30. d7e3d2231f HEAD@{28}: checkout: moving from c06424ac85213ff461ecaca210b62cc2fe868382 to main
  31. c06424ac85 HEAD@{29}: checkout: moving from main to remotes/personal/fixes_2_2
  32. d7e3d2231f HEAD@{30}: checkout: moving from c06424ac85213ff461ecaca210b62cc2fe868382 to main
  33. c06424ac85 HEAD@{31}: checkout: moving from main to remotes/personal/fixes_2_2
  34. d7e3d2231f HEAD@{32}: reset: moving to HEAD
  35. d7e3d2231f HEAD@{33}: clone: from https://gitlab.com/freepascal.org/lazarus/lazarus.git

As you suggested I also ran
Code: Bash  [Select][+][-]
  1. git log --oneline --graph -n 50 main upstream/main personal/main

Bash output is below. Martin I was thinking if I have really messed things up would it not be easier to start again from scratch? Or this can still be salvaged? I am again humbled by the knowledge and experience that is available freely to anyone on this forum.
Code: Bash  [Select][+][-]
  1. * 0f438c98fe CodeTools: fix attribute resolver
  2. * 5f76b3e31c LCL: additional fix to TWinControl.GetClientRect wcfBoundsRealized (DockedFormEditor issue), issue #40052. Patch by rich2014.
  3. * 822f606e97 Docs: LCL/comctrls. Adds content for overridden TPageControl.ChildClassAllowed topic.
  4. * dea606d77f Docs: LCL/printers. Removes TODO entry that has already been handled.
  5. * eb59ad598f JCF: regenerated translations and updated Russian translation
  6. * 5719672f10 Codetools: Fix SmartHint for generic specialized types. Issue #29860.
  7. * 425db255bd Docs: LCL/editbtn. Adds and updates topics for changes in 5f4aa964.
  8. * 421193c712 Docs: LazControls/treefilteredit. Adds and updates topics for changes in 5f4aa964.
  9. * c4dcb8c515 Docs: LazControls/listviewfilteredit. Adds and updates topics for changes in 5f4aa964.
  10. * 9a99d112b5 Docs: LazControls/listfilteredit. Updates topics for changes in 5f4aa964.
  11. * c2a26476f9 buildintf: comment
  12. * 5ea4a1e270 Tools: Fix handling program parameters in runwait.sh. Issue #40045, patch by Dean Mustakinov.
  13. * edbe283fc6 Jedi Code Format: Eliminate an assertion failure in debug mode. Issue #40053, patch by Domingo Galmés.
  14. * 2e160e525d Jedi Code Format: Improve the text for an indentation option. Issue #40054, patch by Domingo Galmés.
  15. * d6bfb829cf Jedi Code Format: Fix a memory leak. Issue #40058, patch by Domingo Galmés.
  16. * 0777a5b939 Jedi Code Format: Fix indentation of generic function forward declarations. Issue #40055, patch by Domingo Galmés.
  17. * be093cd40d Add an example project for FilterEdits. Issue #40035, modified from patch by dbannon.
  18. * 5f4aa96422 LazControls, FilterEdits: Improve setting the filter programmatically. Invalidate after properties change.
  19. *   70bc333d28 Merge branch 'main' into 'main'
  20. |\  
  21. | * 2461afd1b1 Cleanup the code and update libqt*pas version
  22. | * 5d47e14a50 Added NativeEventFilter hook in qt5
  23. | * 7702f3d65a Added NativeEventFilter hook in qt6
  24. |/  
  25. * f0e459f047 FPC: Extend System.UITypes
  26. * 99caa084fc Revert TFontStyles to the original size
  27. * fe6b88d8da CI: added a comment to configuration
  28. * 57cc6997fc CI: added manual job for building docs (and emitting them as artifact) with FPDoc from stable FPC
  29. * 3e36732de6 laz.virtualtrees: fixed crash with qt widgetsets on windows. issue #40056
  30. * d115ec0399 Qt6: fixed building cbindings on windows.
  31. * d7e3d2231f Docs: LCL/lclplatformdef. Adds DirNameToDisplayName and DisplayNameToDirName topics for changes in c45dfb7a.
  32. * 2e64ec91a8 Docs: LCL/printers. Adds, updates topics with aliases to System.UITypes. Changes in 43d7f203.
  33. * d97d330495 Docs: LCL/grids. Adds content to the TCustomStringGrid.SaveColumns and TStringGridStrings topics.
  34. * 651303f114 Docs: LCL/graphics. Adds, updates topics with aliases to System.UITypes. Changes in 43d7f203.
  35. * db360c7ede Docs: LCL/forms. Adds, updates topics for aliases to System.UITypes. Changes in 43d7f203.
  36. * 967e4ee615 Docs: LCL/controls. Adds, updates topics with aliases to System.UITypes. Changes in 43d7f203.
  37. * 5f819ddd36 Docs: LazUtils/uitypes. Updates topics with aliases to System.UITypes. Changes in 43d7f203.
  38. * 21e56937cf CI: added manual jobs for building docs (and emitting them as artifacts) with FPDoc from FPC `main` and `fixes` branches
  39. * a2b7d28e68 CI: store FPDoc executables separately for different FPC versions
  40. * 1b9e56b56c lcl: fixed TWinControl.GetClientRect wcfBoundsRealized, issue #40052
  41. * f87fe0303d lcl gtk3: load theme.css only if existing
  42. * 166d1b6dbf Docs: Removed unneeded .gitignore. The one in root of the Lazarus source directory already has relevant entries.
  43. * ebdc3913ed IDE/images: Add some update and missing icons in File menu. By Roland Hahn.
  44. * 829f320095 FPC: Extend System.UITypes
  45. * c45dfb7a56 IDE: Show Widgetset display name instead of dir name in selection list for project. Issue #40040, patch by theo222.
  46. * 43d7f20349 FPC: Extend System.UITypes
  47. * 5b0ed449f3 Docs: LCL/grids. Updates TCustomStringGrid.Modified topic to reflect usage.
  48. * b72d31e3dc Docs: LazUtils/lconvencoding. Adds and updates topics for changes in 0ae37a90.
  49. * 62f886435d Docs: LazUtils/codepagescommon. Adds topics for changes in 0ae37a90.
  50. * 0ae37a906c LConvEncoding: add EncodingCP865. Patch by Alexey Torgashin. Issue #40041.
  51. * b40000c46c Docs: LCL/comctrl. Updates topic content.
  52. * d7f0ef81fe CI: added archive with CHM docs for stable FPC to build image (needed for building Lazarus docs)


Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" project issues
« Reply #9 on: December 28, 2022, 11:57:46 am »
You haven't done a "git pull personal".

I am confused now @Martin_fr I thought the steps below are what I have to do to 'sync' the repos?

1 - Fork Lazarus main/trunk
2 - clone the fork to my local system
3 - make changes/test/experiment on my local clone( on a separate branch as you pointed out )
4 - push the changes to my remote fork ( in this case 'personal')
5 - create a merge/pull request from my remote 'personal' to lazarus main/trunk (in this case 'upstream')
6 - when needed git pull upstream to 'sync' things again?

So why do I need to git pull personal? personal is the fork which has no changes so why pull it? very confused here..
Or as is usual I am not seeing the big picture?
« Last Edit: December 28, 2022, 02:29:32 pm by Aruna »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: "TestAll" project issues
« Reply #10 on: December 28, 2022, 04:03:01 pm »
Ok, I think I found what is going on. I did have a look at your online repo at gitlab.

The top commit in your main branch https://gitlab.com/aruna.hewapathirane/lazarus/-/commits/main is
Code: Text  [Select][+][-]
  1. Commit dd428486
  2. authored 5 Dec 2022, 15:50 by Aruna Hewapathirane's avatar Aruna Hewapathirane
  3. Merge remote-tracking branch 'upstream/main'
And if you look at the graph https://gitlab.com/aruna.hewapathirane/lazarus/-/network/main (you have to scroll down a bit),
you will find that this merge contains your working branch (ending with Commit 9db84220 "Delete Laz_Hello.lpi")

So you did do commits to the "main" branch.
And you pushed them.
And that is why you are getting errors.

But before I get into detail, a bit of background and some other info.

Steps to fix are at the end of this post. So you can skip forward



1) "git log --graph --oneline"

For some reason your output does not contain any branch/tag names at all. Here is what I get (and what afaik should be default).
You can see some lines start with "(" and then branch names. (on the console this usually is colored).
- So the commit on the first line is at "HEAD" which points to the branch "main_gitlab".
  It also is at origin/main and origin/HEAD
- The 2nd line is at "main" (that is my local main branch)

Code: Text  [Select][+][-]
  1. * cbef44b7ef (HEAD -> main_gitlab, origin/main, origin/HEAD) CodeTools: fix attribute resolver - remove exception handling
  2. | * 4190c37981 (main) DebuggerOptions, EnvironmentOptions: move class-config
  3. | * e215aa22c2 EnvironmentOptions: When saving data, don't destroy any existing xml. (if data on disk changed)
  4. |/
  5. * 0f438c98fe CodeTools: fix attribute resolver

This allows me to quickly see where the "tips" of all my branches are.



2) "branch" / "tip" or "head" of a branch .... (nomenclature)

Maybe worth, making sure we talk about the same thing....

The (English) word "branch" is used for a variety of things.
It can be
- A series of commits known by the branch name (i.e. all the commits that "git log <branchname>" will show)
  Mind that the branch starts at the very first commit of the repo. Not at the "fork-point" (where the branch was created / diverts from another branch).
  So some (older) commits on a branch are usually shared with other branches
- A reference to the "branchname"
- The "tip" (sometimes also "head of") of the branch. That is the latest commit made to the branch.
  This is the commit on which "git log" will display the branch-name


3) "branch" local vs remote (vs "distributed")

There exists more than one "branch" called "main".
(And the same is true for most other branches / well any branch that is pushed/pulled to/from a remote)

* All the below is using "main". But applies to any other branch that exists on a remote.

You can have a git repo without remote (only your local copy). Then you only have one "main" branch.
You commit to it, and the tip of main will be on the new commit.

Now if you have a remote, the remote may have 3 commit in main (left = oldest)
REMOTE:
   A - B - C (main)

If you clone/pull that remote to a local repo:
- then your local repo will remember that the remote has "main" on "C". ("origin" in the example is the name of the remote)
- your local repo will create a local main branch on the same commit. (or it will be created when you switch/checkout to it)

LOCAL
   A - B - C (main, origin/main)

If you make a commit to "main" you make it locally. So it affects your local branch.
Both:
- The series of commits. As you have one more commit
- The "tip" of the branch. As it move forward

LOCAL (with your commit)
   A - B - C (origin/main) - D (main)

As you can see, your local repo still has a memory where the remote has (or maybe had) the tip of its branch.

If you push then you send all the commits that you added to the remote.
=> Well, if all goes as expected.

But what if someone else pushed to the remote...

If someone else pushed to the remote, then you don't have that persons commit.

REMOTE (with someone's commit):
   A - B - C - E (main)

LOCAL (with your commit)
   A - B - C (origin/main) - D (main)

So now there are 3 versions of the main branch.
1) Your local "main"
2) Your local last-know-remote "origin/main"
3) the actual remote "main"

Unlike SVN which will merge at the server, git will not accept your push.
GIT always requires that you do the merging yourself.

To be precise: Git requires that your "origin/main" and the actual remote's "main" are the same, in order for you to push.

So the push then can just add the new commits you made, to the tip of the remote. And the remote will be 100% the same as your local copy.

(Mind, your local repo has 2 remotes. So it has to memorized-remote branches upstream/main and personal/main)




4) "git pull"  and tracking

The local branch usually knows to which remote branch it belongs. (called tracking).
That is, your local branch does not have to have the same name, it could be called anything. In most cases such relationships are defined by tracking (usually set at creating time, or when first pushing). The name only matters in a few cases.

REMOTE (with someone's commit):
   A - B - C - E (main)

LOCAL (without any commit by you)
   A - B - C (main, origin/main)

Now if you do "git pull" it will get the commit "E". And the "origin/main" will be pointing to that (since it will be the last we have seen on the remote).

In this case your local "main" will also be changed. It will be "fast forwarded" (i.e. it will move forward to the commit E).
(Note that fast-forward is considered a "merge", even though there is no merge-commit)


But in case of

REMOTE (with someone's commit):
   A - B - C - E (main)

LOCAL (with your commit)
   A - B - C (origin/main) - D (main)

You get
LOCAL (after pull - before any update to your local "main")
   A - B - C - E (origin/main)
           \ - D (main)

The (versions of the)  "main" branch have "diverged" => they are no longer in a straight line.

"git pull" will by default merge them. It will create a Merge commit "F":
(And that is what happened to you)
   A - B - C - E (origin/main) - F (main)
           \ - D -              /



=> Avoiding merge commits by pull "git config pull.ff only"
https://wiki.freepascal.org/SVN_to_GIT_Cheatsheet#Recommended

And then "git rebase" or configure pull to do the rebase => check the git manpages.




5) The error you got

Now your pushed the above merge commit to your forked remote "personal"....
But that commit is not in our Lazarus git repo.

You local branch "main" is tracking our remote main.
- So "git pull upstream" will affect the local "main".
- "git pull personal" will not affect the local "main"

Anyway your your remote "personal" main now has a commit (the merge) that is not in our remote "upstream" main. 
And your local "main" is "up to date" with "upstream/main" (your git status said so).
So your local main does not contain the merge commit (including all your commits that were merged) that you pushed to "personal".
And that means you can't push this commit to personal.




6) Fixing your situation...
(and make sure you change "git pull" as above)

You want "personal/main" to be an exact copy of our "upstream/main".
So you need to move your commits to a new branch.

a) create the new branch.

  git branch my-diverged-main main
Creating my-diverged-main to replace "main" (because we later move/reset "personal/main", and then the new branch makes sure all your commits are kept)

  git branch my-work 9db8422087ac5c156d5d20f8c20feaf329f65ae2
The sha1 is from your online repo (but will be the same in your local repo). It is the "Delete Laz_Hello.lpi" commit
You now have a branch "my-work" on that commit.

Create any other branches you may need for any local commits you have made since (i.e. not yet pushed)


  git push  --set-upstream  personal  my-diverged-main
  git push  --set-upstream  personal  my-work
Now you have your work on your remote. As a new branch.
Check that gitlab shows this

Pushing my-diverged-main is optional. It only contains the merge-commit, which likely you will not need.

b) change/correct personal/main

  git push --force-with-lease personal main

This will override the remote branch.
That is, the current "main" on the upstream remote will be replaced (deleted) by the new "main" as it is in your local repo (and that is up to date with upstream).

Mind, it only "deletes" the old location (tip). of the branch.

The commits will remain, because you created new branches that also contain the new commits.
If you had not created those new branches, then the commits would become unreachable.

Once fixed, and assuming you do not add your own commits to main again, then you will not need the "force with lease" again. It should work with just
  git push personal main





8) git switch vs git checkout

If your have a current version of git, I recommend you look up "git switch" and use it instead of "git checkout".
But it's a personal decision.
See the wiki page that I linked.

« Last Edit: December 28, 2022, 04:17:49 pm by Martin_fr »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: "TestAll" project issues
« Reply #11 on: December 28, 2022, 04:08:15 pm »
Please note "--force-with-lease" is the fix ONLY in this case.

In other similar cases, you want to keep things, and integrate the branches with each other => so you would need to do some merges or rebases....
Not going into detail....

But do not use "--force-with-lease" for any other issues. (Unless you really really know what you do).

And never ever use just "--force" for a push.

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" project issues
« Reply #12 on: December 29, 2022, 03:47:37 am »
@Martin_fr I am speechless. No human can do what you just did. That kind of analytical prowess is usually reserved for the Gods.

Thank you so very much for what you sent. That is probably one of the best (if not the best) explanations and troubleshooting I have enjoyed reading in a very long while. Wow, you should go teach university my friend! Actually in an advisory capacity to the IT professors and their departments.

Someday I will learn to think like this ( I wish... sigh!) That took a lot of your time and some considerable analysis so for what it's worth should we ever meet in person the food and beer is on me. 

It is getting late here in Tronto and been a long day I am going to crash soon. I will respond in detail tomorrow.

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" project issues
« Reply #13 on: January 02, 2023, 09:51:34 am »
Happy New Year 2023 to everyone..

  git push --force-with-lease personal main

This will override the remote branch.
That is, the current "main" on the upstream remote will be replaced (deleted) by the new "main" as it is in your local repo (and that is up to date with upstream).

Hi @Martin_fr I tried to follow your instructions to the letter and I learnt a lot along the way I am very grateful for all the guidance and explanations. But I am getting git errors again. Please see below.
Code: Bash  [Select][+][-]
  1. aruna@debian:/media/aruna/linux-next/lazarus$ git push --force-with-lease personal main
  2. Username for 'https://gitlab.com': Aruna.Hewapathirane
  3. Password for 'https://Aruna.Hewapathirane@gitlab.com':
  4. Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
  5. remote: GitLab: You are not allowed to force push code to a protected branch on this project.
  6. To https://gitlab.com/aruna.hewapathirane/lazarus.git
  7.  ! [remote rejected]       main -> main (pre-receive hook declined)
  8. error: failed to push some refs to 'https://gitlab.com/aruna.hewapathirane/lazarus.git'

I am on this branch below.
Code: Bash  [Select][+][-]
  1. aruna@debian:/media/aruna/linux-next/lazarus$ git branch
  2.   fixes_2_2
  3.   main
  4. * my-diverged-main
  5.   my-work
  6.   testall
  7.  

I am going to reset the HEAD to my initial fork clone commit that hopefully should get me back to a clean main with nothing pushed from me.

Code: Bash  [Select][+][-]
  1. d7e3d2231f (HEAD -> main, personal/my-diverged-main, testall, my-diverged-main) HEAD@{43}: clone: from https://gitlab.com/freepascal.org/lazarus/lazarus.git

Code: Bash  [Select][+][-]
  1. git reset --hard d7e3d2231f

If I still start hitting brick walls after doing so I think it is time to delete this repo and start with a clean slate? Thank you so much for your time, I have learnt so much.
« Last Edit: January 02, 2023, 09:57:13 am by Aruna »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: "TestAll" project issues
« Reply #14 on: January 07, 2023, 09:08:37 pm »
Just Zip the TestAll project and upload it here. :)
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018