Useful Hg Commands for source code Management

  1. hg st – shows the changed file
  2. hg history – shows the changed history
  3. hg history | head -40 – shows the changed history for last 40 changes
  4. hg branch – shows the current branch
  5. hg branches – shows all the branches in reprository
  6. hg update -C -Reset the changes and reflect same as parent directory
  7. hg pull –update – Pull the latest code and update
  8. hg commit -m “Message” – Does the commit
  9. hg push – Push the code the current branch
  10. hg addremove – Its a good practice to use this as it helps in not conflicting
  11. hg revert –no-backup filename – Reverts the changes which we have done in that file
  12. hg diff filename – shows the difference of file

Steps to do initial push from local to Reprository with hg mercurial

  • first write on hg st on your project directory, it will show the file which has got the changes
  • Then write hg commit -m “Initial Commit”
  • Then write  hg pull –update
  • Then write hg push
  • This will push all your changes to reprository.
  • If you want to revert the changes the use hg revert –no backup and then the directory of the filename

 

Advertisements

$form element with #type => ‘submit’ with custom submit and validate function

$form[‘copy_local’] = [
‘#type’ => ‘submit’,
‘#prefix’ => ‘<br>’,
‘#name’ => ‘public’,
‘#value’ => $this->t(‘Copy local public files to S3’),
‘#validate’ => [
[$this, ‘copyLocalValidateForm’],
],
‘#submit’ => [
[$this, ‘copyLocalSubmitForm’],
],
];

public function copyLocalValidateForm(){

//Code Here

}

When we click on this submit button then the #validate is called first and the #submit.It will check for the custom method in same class and then call that method.

 

 

 

 

 

Linux Commands

1. cd- It stands for change directory.
Usage: if you are at some directory on terminal and want to move to another
directory then use cd pathname/path.

2. sudo -super user do. Means if the permission of a file is given to owner the others can access by using sudo.
3. locate- it is used to search for a file.
4. tail- it is used to print last 10 lines of each files to standard output.

5. cp – copy paste

6. grep -r “filename” –  Search for the selected word in whole document.