Line 8:
Line 8:
[[Category:FAQ EN]]
[[Category:FAQ EN]]
{{TemplateDocDevEn}}
{{TemplateDocDevEn}}
−
This is informations on how you can get sources of Dolibarr project.
+
This is information on how you can get sources of Dolibarr project.
−
Several methods are described, but we recommandusing the one based on GitHub.
+
Several methods are described, but we recommand using the one based on GitHub.
−
=Get last version of sources by tgz download=
=Get last version of sources by tgz download=
Line 24:
Line 23:
You can use this method if you don't have any GIT access. With this method, you won't be able to submit any changes, so, if you are a developer, it is recommended to create a GitHub account and use the next method instead of this one.
You can use this method if you don't have any GIT access. With this method, you won't be able to submit any changes, so, if you are a developer, it is recommended to create a GitHub account and use the next method instead of this one.
−
== Prerequisite ==
+
==Prerequisite==
−
* With Eclipse IDE
+
+
*With Eclipse IDE
+
First you must have a working install of Eclipse. '''EGit''' plugin must also have been installed.
First you must have a working install of Eclipse. '''EGit''' plugin must also have been installed.
For this, use the '''Find And Install process''' into Eclipse menu, add the GIT update URL:
For this, use the '''Find And Install process''' into Eclipse menu, add the GIT update URL:
Line 31:
Line 32:
Then choose to install '''EGit''' (No need to choose JGit)
Then choose to install '''EGit''' (No need to choose JGit)
−
* With the GIT Command Line Client Interface
+
*With the GIT Command Line Client Interface
+
You need to install GIT client (GIT command line tool with Linux installed with "sudo apt-get install git", or the GIT client for Windows found at https://git-scm.com/download/win).
You need to install GIT client (GIT command line tool with Linux installed with "sudo apt-get install git", or the GIT client for Windows found at https://git-scm.com/download/win).
−
== Clone process ==
+
==Clone process==
First, enter value of the repository with reference sources into your GIT client tool.
First, enter value of the repository with reference sources into your GIT client tool.
−
* With Eclipse, go into perspective GIT, click onto button "Clone GIT repository". Enter GIT URL of project to get.
+
*With Eclipse, go into perspective GIT, click onto button "Clone GIT repository". Enter GIT URL of project to get.
+
GIT Url for Dolibarr official source is:
GIT Url for Dolibarr official source is:
<source lang="ini">
<source lang="ini">
Line 51:
Line 54:
</source>
</source>
−
* With GIT on Command Line Interface:
+
*With GIT on Command Line Interface:
+
First setup your git client:
First setup your git client:
<source lang="bash">
<source lang="bash">
Line 75:
Line 79:
Once download is finished, you must choose which branch to us to work on.
Once download is finished, you must choose which branch to us to work on.
−
* With GIT on Command Line Interface;
+
*With GIT on Command Line Interface;
+
<source lang="bash">
<source lang="bash">
git checkout develop
git checkout develop
Line 81:
Line 86:
</source>
</source>
This will create local branch and make checkout automatically.
This will create local branch and make checkout automatically.
−
* With Eclipse, right click on "Branches - Remotes - The branch you want to duplicate locally".
+
+
*With Eclipse, right click on "Branches - Remotes - The branch you want to duplicate locally".
+
Choose "Create Branch" (and check the box "Checkout"). This will duplicate content of branch to work on it locally and will refresh your "Working Directory" to work on this branch.
Choose "Create Branch" (and check the box "Checkout"). This will duplicate content of branch to work on it locally and will refresh your "Working Directory" to work on this branch.
Line 95:
Line 102:
=Get last version of sources using a GitHub user access=
=Get last version of sources using a GitHub user access=
−
== Prerequisite ==
+
==Prerequisite==
+
+
*With Eclipse IDE
−
* With Eclipse IDE
You must before create an account on GitHub (https://github.com/) and upload a public RSA or DSA certificate into your account profile.
You must before create an account on GitHub (https://github.com/) and upload a public RSA or DSA certificate into your account profile.
Line 105:
Line 113:
Then choose to install '''EGit'''.
Then choose to install '''EGit'''.
−
* With the GIT Command Line Client Interface:
+
*With the GIT Command Line Client Interface:
+
You must before create an account on GitHub (https://github.com/) and upload a public RSA or DSA certificate into your account profile.
You must before create an account on GitHub (https://github.com/) and upload a public RSA or DSA certificate into your account profile.
Then, you need to install GIT client (GIT command line tool with Linux installed with "sudo apt-get install git", or the GIT client for Windows found at https://git-scm.com/download/win).
Then, you need to install GIT client (GIT command line tool with Linux installed with "sudo apt-get install git", or the GIT client for Windows found at https://git-scm.com/download/win).
−
== Fork process ==
+
==Fork process==
Login to Github, with login you created in previous step. Then go onto page
Login to Github, with login you created in previous step. Then go onto page
Line 119:
Line 128:
This will create a copy (a fork) of project into your own github area. Because you will be the owner of this fork, you will have all permissions on it to be used in next steps.
This will create a copy (a fork) of project into your own github area. Because you will be the owner of this fork, you will have all permissions on it to be used in next steps.
−
== Clone process ==
+
==Clone process==
Then process is same as getting sources with anonymous access.
Then process is same as getting sources with anonymous access.
Line 135:
Line 144:
To update your local workspace:
To update your local workspace:
−
* With Eclipse IDE:
+
*With Eclipse IDE:
+
right click on Eclipse project and select "Pull".
right click on Eclipse project and select "Pull".
If you made some changes into your Eclipse workspace on files that were changed into the GIT remote reference, your GIT client will make a merge automatically.
If you made some changes into your Eclipse workspace on files that were changed into the GIT remote reference, your GIT client will make a merge automatically.
−
* If there is conflicts, the merge will mark all conflict files as "conflict" (See later to solve this state).
+
−
* If not, you will get all new version files including all your changes.
+
*If there is conflicts, the merge will mark all conflict files as "conflict" (See later to solve this state).
+
*If not, you will get all new version files including all your changes.
If you already have commited some files into your local repository, your workspace will be marked as "Merged".
If you already have commited some files into your local repository, your workspace will be marked as "Merged".
Line 147:
Line 158:
*With the GIT Command Line Client Interface:
*With the GIT Command Line Client Interface:
+
<source lang="bash">
<source lang="bash">
git pull
git pull
</source>
</source>
−
= Commit and publish your changes =
+
=Commit and publish your changes=
To see all changes you made into your working directory and waiting to be added into Git:
To see all changes you made into your working directory and waiting to be added into Git:
−
* With GIT Command Line Interface:
+
+
*With GIT Command Line Interface:
+
<source lang="bash">
<source lang="bash">
git status
git status
Line 160:
Line 174:
To add changes made into your local repository into the GIT index, then commit this index :
To add changes made into your local repository into the GIT index, then commit this index :
−
* With Eclipse: Right click on file or directory to commit. Select file to add/remove/update into commit.
+
−
* With GIT Command Line Interface:
+
*With Eclipse: Right click on file or directory to commit. Select file to add/remove/update into commit.
+
*With GIT Command Line Interface:
+
<source lang="bash">
<source lang="bash">
git commit -a -m "Commit text"
git commit -a -m "Commit text"
Line 168:
Line 184:
To push them on the GIT repository server,
To push them on the GIT repository server,
−
* With Eclipse: right click on project and choose "'''Team - Push to Upstream'''".
+
−
* With GIT Command Line Interface:
+
*With Eclipse: right click on project and choose "'''Team - Push to Upstream'''".
+
*With GIT Command Line Interface:
+
<source lang="bash">
<source lang="bash">
git push
git push
Line 175:
Line 193:
To cancel a commit:
To cancel a commit:
−
* With GIT Command Line Interface, if commit was not already pushed:
+
+
*With GIT Command Line Interface, if commit was not already pushed:
+
<source lang="bash">
<source lang="bash">
git reset --soft HEAD~1
git reset --soft HEAD~1
</source>
</source>
−
* With GIT Command Line Interface, if commit was already pushed:
+
+
*With GIT Command Line Interface, if commit was already pushed:
+
<source lang="bash">
<source lang="bash">
git revert IdCommit or git revert HEAD (for last commit)
git revert IdCommit or git revert HEAD (for last commit)
Line 185:
Line 207:
To merge changes done into your forked GIT instance into official Dolibarr instance:
To merge changes done into your forked GIT instance into official Dolibarr instance:
−
* Go into GitHub web interface of your forked Git instance.
−
* Click on small button "Create a Pull request".
−
* Choose commit you request inclusion and validate.
−
= Ask official project to include your changes =
+
*Go into GitHub web interface of your forked Git instance.
+
*Click on small button "Create a Pull request".
+
*Choose commit you request inclusion and validate.
+
+
=Ask official project to include your changes=
Once you pushed one or several commit toward your distant fork area on github, you can ask the Dolibarr core team to include it into official project.
Once you pushed one or several commit toward your distant fork area on github, you can ask the Dolibarr core team to include it into official project.
For this, follow this tutorial: https://help.github.com/articles/creating-a-pull-request/
For this, follow this tutorial: https://help.github.com/articles/creating-a-pull-request/
−
= Add an external commit into current repository =
+
=Add an external commit into current repository=
Some developers may work and do commit into their own Git repository after forking the project. If you are interesting into getting this changes, you can import them with the following steps.
Some developers may work and do commit into their own Git repository after forking the project. If you are interesting into getting this changes, you can import them with the following steps.
You need both Eclipse and GIT Command Line interface to achieve this:
You need both Eclipse and GIT Command Line interface to achieve this:
−
* First, go into GIT setup view and right click on "'''Remotes'''" of your Eclipse Git working space and choose "'''Create a remote...'''"
+
−
* Type name or remote fork the developer has create (in most cases, it's developer Git login). For example: "'''thedevlogin'''". Choose also "'''Configure Fetch'''".
+
*First, go into GIT setup view and right click on "'''Remotes'''" of your Eclipse Git working space and choose "'''Create a remote...'''"
−
* Type URI of Git repository of developer. For example: '''git://github.com/thedevlogin/dolibarr.git'''. Also add a refspec value to declare the branch you want to get. For example: '''refs/heads/master:refs/remotes/thedevlogin/master'''. Click "'''Save and Fetch'''". A new entry will be added into "Remote Tracking" making possible to read/get commits done into this branch.
+
*Type name or remote fork the developer has create (in most cases, it's developer Git login). For example: "'''thedevlogin'''". Choose also "'''Configure Fetch'''".
+
*Type URI of Git repository of developer. For example: '''git://github.com/thedevlogin/dolibarr.git'''. Also add a refspec value to declare the branch you want to get. For example: '''refs/heads/master:refs/remotes/thedevlogin/master'''. Click "'''Save and Fetch'''". A new entry will be added into "Remote Tracking" making possible to read/get commits done into this branch.
Now, go on command line of your git repository (in most cases on Linux, it's '''/home/yourlogin/git/yourdolibarr''') and type the git cherry-pick command:
Now, go on command line of your git repository (in most cases on Linux, it's '''/home/yourlogin/git/yourdolibarr''') and type the git cherry-pick command:
Line 221:
Line 245:
If you prefer to forget completely all changes you made into all files (so to restore you workspace with content of remote repository), you can make a hard reset:
If you prefer to forget completely all changes you made into all files (so to restore you workspace with content of remote repository), you can make a hard reset:
−
* With Eclipse: Right click on project top line and select "'''Reset'''" then "'''Hard'''" then "'''Reference - HEAD'''".
+
−
* With GIT Command Line Interface: You can achieve this with command
+
*With Eclipse: Right click on project top line and select "'''Reset'''" then "'''Hard'''" then "'''Reference - HEAD'''".
+
*With GIT Command Line Interface: You can achieve this with command
+
<source lang="bash">
<source lang="bash">
git reset --hard HEAD
git reset --hard HEAD
Line 266:
Line 292:
It may also be required to edit the .git/config file to have project linked by default onto new branch.
It may also be required to edit the .git/config file to have project linked by default onto new branch.
−
= Deleting a branch=
+
=Deleting a branch=
With GIT Command Line Interface:
With GIT Command Line Interface:
Line 276:
Line 302:
=Merging a maintenance branch x.x into dev branch=
=Merging a maintenance branch x.x into dev branch=
With Eclipse:
With Eclipse:
−
* Go onto the root directory of project with a checkout of the dev branch.
−
* Check fetch setup to be sure, this repository contains both information of dev branch and version x.x you want to merge.
−
* Right click onto root directory and choose "Team - Merge". Select "x.x". Click onto "Merge options - Commit", because we want to commit merged branch if there is no conflicts.
−
* Once merge is done, check everything is ok.
−
* Commit and push.
−
= Pushing a branch onto another Git server =
+
*Go onto the root directory of project with a checkout of the dev branch.
+
*Check fetch setup to be sure, this repository contains both information of dev branch and version x.x you want to merge.
+
*Right click onto root directory and choose "Team - Merge". Select "x.x". Click onto "Merge options - Commit", because we want to commit merged branch if there is no conflicts.
+
*Once merge is done, check everything is ok.
+
*Commit and push.
+
+
=Pushing a branch onto another Git server=
You may want to synchronize another GIT server.
You may want to synchronize another GIT server.
To synchronize push to another server, this is how to proceed.
To synchronize push to another server, this is how to proceed.
With Eclipse:
With Eclipse:
−
* Go onto Git clone view and add a remote with a name, choose "Configure push" and enter URL. For example, for name "sourceforge" and URL "ssh://yoursourceforgelogin@git.code.sf.net/p/dolibarr/code"
+
−
* Just validate, a first push will be done automatically.
+
*Go onto Git clone view and add a remote with a name, choose "Configure push" and enter URL. For example, for name "sourceforge" and URL "ssh://yoursourceforgelogin@git.code.sf.net/p/dolibarr/code"
−
* To force sync, run
+
*Just validate, a first push will be done automatically.
+
*To force sync, run
+
<source lang="bash">
<source lang="bash">
git push sourceforge develop
git push sourceforge develop
Line 298:
Line 327:
To count number of changes developers have made between a version x and y:
To count number of changes developers have made between a version x and y:
−
* First, search commit id of tags you want to compare
+
+
*First, search commit id of tags you want to compare
+
To find id_start (common commit id between 2 versions/tags)
To find id_start (common commit id between 2 versions/tags)
<source lang="bash">
<source lang="bash">
Line 311:
Line 342:
Choose a value for id_start and id_end
Choose a value for id_start and id_end
Note: id_end can be HEAD.
Note: id_end can be HEAD.
−
* Then run git log to have list of all changes from last common commit to last commit
+
+
*Then run git log to have list of all changes from last common commit to last commit
+
<source lang="bash">
<source lang="bash">
git log id_start..id_end
git log id_start..id_end
</source>
</source>
−
* To get total number of added/deleted lines:
+
+
*To get total number of added/deleted lines:
+
<source lang="bash">
<source lang="bash">
git log --ancestry-path --numstat --pretty="%H" id_start..id_end | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
git log --ancestry-path --numstat --pretty="%H" id_start..id_end | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
Line 322:
Line 357:
To count number of changes finally between a version x and y (it differs from previous count because in previous count, a change can be done 2 times at two different moment to change differently. With second method, you count changes finally found if changes were ok at first try).
To count number of changes finally between a version x and y (it differs from previous count because in previous count, a change can be done 2 times at two different moment to change differently. With second method, you count changes finally found if changes were ok at first try).
−
* Use same method than previously but instead of running git log, run git diff.
+
+
*Use same method than previously but instead of running git log, run git diff.
+
<source lang="bash">
<source lang="bash">
git diff -b -M --numstat --pretty="%H" id_start..id_end | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
git diff -b -M --numstat --pretty="%H" id_start..id_end | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'