Monday, 19 December 2016

Finish Drupal Ladder [Drupal Core Ladder] - Re-roll patches to apply cleanly to the latest version of Drupal


Finish Drupal Ladder [Drupal Core Ladder] - Re-roll patches

to apply cleanly to the latest version of Drupal



Re-roll patches to apply clearly to the latest version of Drupal


In this part, I am going to update or "re-roll" patches to apply to a newer version of Drupal. I will classified this section into 4 steps.



1.Go to Drupal core issues and search a patch which need to be reviewed by filtering the list of issues tagged as "Needs reroll".




In my case, i am selecting "reroll-1875974-160.patch and I am going to reroll it.


2.Then do the following code below:

   
   CODE:


  • cd /path/to/drupal

  • git pull

  • git apply --check 1875974-statistics_config_settings-5.patch


Result of git apply --check 1875974-statistics_config_setting-5.patch


3.We need to Commit the patch's changes to your local branch.



CODE:


            git status


           git commit -am "Applying patch from issue 1875974"


git commit -am "Applying patch from issue 1875974"


4.Attempt of pulling all of the changes


CODE:


           git rebase 8.2.x




Patch rerolling:


 heervesh@heervesh-VirtualBox:~/drupal$ wget https://www.drupal.org/files/issues/reroll-1875974-160_0.patch
--2016-12-14 14:53:07--  https://www.drupal.org/files/issues/reroll-1875974-160_0.patch
Resolving www.drupal.org (www.drupal.org)... 151.101.17.175
Connecting to www.drupal.org (www.drupal.org)|151.101.17.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26018 (25K) [text/plain]
Saving to: ‘reroll-1875974-160_0.patch’

reroll-1875974-160_0.patch          100%[=================================================================>]  25.41K   132KB/s    in 0.2s   

2016-12-14 14:53:08 (132 KB/s) - ‘reroll-1875974-160_0.patch’ saved [26018/26018]

heervesh@heervesh-VirtualBox:~/drupal$ git apply --check reroll-1875974-160_0.patch
heervesh@heervesh-VirtualBox:~/drupal$ pwd



Finish Drupal Ladder [Drupal Core Ladder] - Test patches

Finish Drupal Ladder [Drupal Core Ladder] - Test patches



INTRODUCTION


Laptop on which installation was performed: HP Windows 10.
To be able to use Ubuntu ,I used a virtualisation software. It is the Virtual Box which has enabled me to install Linux on Windows.


            Download Virtual box:https://www.virtualbox.org/


Ubuntu is a Linux distribution which is a free and open source software.


            Download Ubuntu 16.10:https://www.ubuntu.com/download/desktop


I will endeavour to find any issues, document them; while providing feedback on how to resolve these issues. I will classified this task into 6 steps. 


STEP 1:Installing Git on Linux





1.Installing Git on Ubuntu




First of all, we need to update the system and then we are going to install git.


CODE:

  • sudo apt-get update

  • sudo apt-get install git-core





2.Moving Around on the command line




In this step, you will get familiar with command line.

  • pwd ( present working directory)
     
       
         pwd command tell us about the directory we are located.


  • ls ( List)
     
          
         ls command list the contents of the current directory.


  • cd (Change directory)


         cd command is used to navigate between directories and folders.





NOTE:
        
         
           To cancel an action we use control c.


3. Basic Configuration And Download Drupal Using Git






Basic configuration




The following code are a simple way to update git configuration file.




1.The code below is going to define heervesh as author name to be used for all commits by the current user.


   CODE:
             

               git config --global user.name heervesh






    2.The code below is going to define heerveshdrc1234@gmail.com as author email to be used for all commits by the current user.


       CODE:



             git config --global user.email heerveshdrc1234@gmail.com




        3.The code below is going to set the current setting of core.autocrlf to be true. 


           CODE:



                          git config --global core.autocrlf true






            Download Drupal Using Git



            1.The git clone http://git.drupal.org/project/drupal.git is going to clone  http://git.drupal.org/project/drupal.git onto local machine




            CODE:






                    git clone http://git.drupal.org/project/drupal.git


                2.Git checkout 8.2.x is going to check  the branch 8.2.x


                CODE:

                        git checkout 8.2.x


                    3.Git pull is going to fetch the specified remote’s copy of current branch and immediately merge it into the local copy.


                    CODE:


                            git pull





                      5.Download a Project Using Git


                        • First of all, we need to move to modules found in Drupal as shown in the previous screenshot. we are going to use cd modules but make sure that you are in Drupal root.



                        • Then, we should go  to the link below and find a project on Drupal. Then click version control situated just below admin toolbar.
                                  

                                  LINK:https://www.drupal.org/project/admin_toolbar/git-instructions




                        First of all, I will do


                                  git clone --branch 8.x-1.x https://git.drupal.org/project/admin_toolbar.git


                                  and then  cd  admin_toolbar  in your terminal.

                          • Once the clone is completed, do the following code:


                                     1.ls -a



                                2.git status



                                3.git branch -a



                                4.git log -3






                          STEP 3:Testing patch


                          1)Move into Drupal 8 sandbox which you have cloned using cd command.
                          Then, check on which branch you are located.


                              CODE:


                                   git branch
                                  

                              NOTE:


                              If you are not an asterisk next to 8.x, you need to check out 
                              8.x


                              CODE:


                                   git checkout 8.x




                          2)WE are going to do the steps for getting started in the issue queue.


                              Link:



                             1.Go to Drupal 8 sandbox issue queen and making the necessary changes.


                                Changes:
                             
                            • Under component: select Miscellaneous


                            • Under category:select Bug report

                                   Then insert the line below as tittle:


                                        Rewrite description for URL alias on node/add/*


                                  Then copy the text below, paste into the issue summary and save it as shown in the     
                                  screenshot below:



                              Note: This issue is being posted here as an exercise by a participant in the http://drupalladder.org ladder for contributing to core. Please don't do anything with this post. The real issue has already been resolved in Drupal 8. If you would like to try this exercise yourself, visit http://drupalladder.org and click on Drupal Ladder

                              Current:
                              Optionally specify an alternative URL by which this content can be accessed. For example, type "about" when writing an about page. Use a relative path and don't add a trailing slash or the URL alias won't work.

                              Proposed:
                              The alternative URL for this content. For example, type "about" when creating an about page. Use a relative path without a trailing slash


                                  




                              STEP 2:Install Drupal 8 sandbox for Drupal ladder.



                              CODE:


                              • git clone --branch 8.x https://git.drupal.org/sandbox/bhirsch/1388780.gitdrupal_8_sandbox_for_drupal_ladder

                              • cd drupal_8_sandbox_for_drupal_ladder





                              3)Download the patch and save it as .patch


                              diff --git a/core/modules/path/path.module b/core/modules/path/path.module
                              index 332287d..8ca61a5 100644
                              --- a/core/modules/path/path.module
                              +++ b/core/modules/path/path.module
                              @@ -136,7 +136,7 @@ function path_form_node_form_alter(&$form, $form_state) {
                                   '#maxlength' => 255,
                                   '#collapsible' => TRUE,
                                   '#collapsed' => TRUE,
                              -    '#description' => t('Optionally specify an alternative URL by which this content can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
                              +    '#description' => t('The alternative URL for this content. Use a relative path without a trailing slash. For example, enter "about" for the about page.'),
                                 );
                                 $form['path']['pid'] = array('#type' => 'value', '#value' => $path['pid']);
                                 $form['path']['source'] = array('#type' => 'value', '#value' => $path['source']);
                              @@ -303,4 +303,4 @@ function path_taxonomy_term_update($term) {
                               function path_taxonomy_term_delete($term) {
                                 // Delete all aliases associated with this term.
                                 path_delete(array('source' => 'taxonomy/term/' . $term->tid));
                              -}
                              +







                              Getting started in the issue queue

                              Finish Drupal Ladder [Drupal Core Ladder] - Getting started in the issue queue (Drupal)



                              INTRODUCTION


                              Issue queue is a collection of requests and bug fixes including their status. It is used by developers and users to discuss changes and report bugs.



                              Laptop on which installation was performed: HP Elite Pro running Windows 10.

                              To be able to use Ubuntu, I used a virtualisation software. It is the Virtual Box which has enabled me to install Linux on Windows.


                                          Download Virtual box:https://www.virtualbox.org/


                              Ubuntu is a Linux distribution which is a free and open source software.


                                          Download Ubuntu 16.10:https://www.ubuntu.com/download/desktop


                              I will endeavour to find any issues, document them; while providing feedback on how to resolve these issues. I will classified this task into 3 steps.

                              STEP 1:Installing Git on Ubuntu



                              1.Installing Git on Ubuntu



                              First of all, we need to update the local repository and then we are going to install git.



                              CODE:


                              • sudo apt-get update




                              • sudo apt-get install git-core



                              Installing Git



                              2.Moving Around on the command line


                              In this step, you will get familiar with command line.



                              • pwd command tell us about the directory we are located.



                                     CODE:



                                                pwd




                              • ls command list the contents of the current directory.



                                       CODE:

                                                   LS






                              • cd command is used to navigate between directories and folder.
                                 
                                     CODE:


                                                
                                                  cd





                              NOTE:
                                      
                                       
                                         To cancel an action we use control c.


                              3. Basic Configuration for Git

                              Basic configuration


                              The following code are a simple way to update git configuration file.


                              1.The code below is going to define heervesh as author name to be used for all commits by the current user.


                                 CODE:
                                           

                                             git config --global user.name heervesh



                              2.The code below is going to define heerveshdrc1234@gmail.com as author email to be used for all commits by the current user.


                                 CODE:


                                     git config --global user.email heerveshdrc1234@gmail.com


                                3. The code below is going to set the current setting of core.autocrlf to be true so as to convert Linux (LF) line ending into Windows (CRLF) line and vice-versa when it checks out code onto the file system


                                   CODE:


                                                git config --global core.autocrlf true








                                STEP 2:Install Drupal 8 sandbox for Drupal ladder




                                CODE:


                                • git clone --branch 8.x https://git.drupal.org/sandbox/bhirsch/1388780.gitdrupal_8_sandbox_for_drupal_ladder





                                • cd drupal_8_sandbox_for_drupal_ladder




                                Installing Drupal 8 sandbox




                                STEP 3:Getting started in the issue queue



                                Go to Drupal 8 Sandbox and making the necessary changes.



                                • Under component: select Miscellaneous




                                • Under category: select Bug report




                                       Then insert the line below as tittle:


                                            Rewrite description for URL alias on node/add/*





                                  Then copy the text below, paste into the issue summary and save it as shown in the screenshot below:




                                  Note: This issue is being posted here as an exercise by a participant in the http://drupalladder.org ladder for contributing to core. Please don't do anything with this post. The real issue has already been resolved in Drupal 8. If you would like to try this exercise yourself, visit http://drupalladder.org and click on Drupal Ladder

                                  Current:
                                  Optionally specify an alternative URL by which this content can be accessed. For example, type "about" when writing an about page. Use a relative path and don't add a trailing slash or the URL alias won't work.

                                  Proposed:


                                  The alternative URL for this content. For example, type "about" when creating an about page. Use a relative path without a trailing slash



                                  Creating issues





                                  Confirm a reported bug and improve the issue





                                  Addition: Updating my issue






                                  Now, I am going to update my current issue summary into an issue summary template:










                                  Issue summary template link:https://www.drupal.org/node/1155816



                                  STEPS:




                                  1.Click on update this issue on rewrite description for url alias on node/add/* as shown below.







                                  2.Copy the issue summary template and go back to your URL alias on node/add/*


                                  Copy of Issue Summary Template


                                  3.Remove the previous issue summary and paste the new one.




                                  Pasting Issue summary Template

                                  4.Then,click save.



                                  Saving issue summary template


                                       Link:https://www.drupal.org/node/2835085/edit


                                  5.Then,refresh your web page. You will see that your issue is updated.



                                  Result of updating issue


                                  LINK:https://www.drupal.org/node/2835085#comment-11836547



                                  Outcome:


                                  I have learned about creating a basic issue post, confirming a reported bug and how to update that issue for improvement in Drupal and it's workflow. When I will create a basic issue post in Drupal, I will use those skills to improve the module that I have developed.