Finish Entire Drupal Ladder [Git Basics]
INTRODUCTION
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
In line with the current task, I will now undertake to begin climbing the ladder for this specific task. I will endeavour to find any issues, document them; while providing feedback on how to resolve these issues.
Git Basics |
Git Basics Ladder:http://drupalladder.org/ladder/383e5471-bb44-e4f4-890d-b3bace6f6651
1.Getting started with Git
This section consist tutorial of git which helps me in getting familiar with git.
2.Installation of Git
In this section, I have learn how to install git on Ubuntu (Linux), basic command to move around in command line, basic configuration and download Drupal using git. This section also helps us to get familiar with how to download a project using git.
I will divide this section into 5 steps.
STEP 1:Installing Git on Linux
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
Installing Git
|
Result of Installing Git |
STEP 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.
Example of ls.pwd and cd commands
|
NOTE:
To cancel an action we use control c.
STEP 3: Basic Configuration And Download Drupal Using Git
Basic configuration
The following code are a simple way to update git configuration file.
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:
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:
CODE:
- git pull
Basic Configuration And Download Drupal Using Git |
STEP 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.
- Th0en, we should go to the link below and find a project on Drupal. Then click version control situated just below admin toolbar.
LINK:
Admin Toolbar-Version control |
- First of all, 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
Link for Drupal Ladder:Installation of Git
3.Write a patch
STEP 1: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
Downloading Drupal 8 sandbox |
STEP 2:Getting started in the issue queue
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/*
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 |
Rewrite description for URL alias on node/add/* |
Step 3:Create a branch for development
To be able to create a branch for development, we should check for branch,create a branch,check out the branch and then confirm that you are in the branch that you have just created.
1.git branch check what branch you're in and make sure you are in 8.x.
CODE:
git branch
2.The code below create a branch where you will work on your patch.
CODE:
git branch 2835085-rewrite-description-for-url-alias
3.Now check out the branch you just created.
CODE:
git checkout 2835085-rewrite-description-for-url-alias
4.Confirm you're on the branch you just created.
CODE:
git branch
Git branch |
STEP 4:Make your Edits
I am going to use kate editor to edit path.module file.
Using Kate editor to replace line |
LINK:https://www.drupal.org/files/issues/patch_131.diff
Bonus: Re-roll the patch
diff --git a/core/modules/path/path.module b/core/modules/path/path.module
index 332287d..d9bfded 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, type "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));
-}
+
LINK:https://www.drupal.org/files/issues/patch_2_0.diff
index 332287d..d9bfded 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, type "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));
-}
+
LINK:https://www.drupal.org/files/issues/patch_2_0.diff
4.Test 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));
-}
+
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));
-}
+
5.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.
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
Patch rerolling:
--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
No comments:
Post a Comment