Wednesday, March 3, 2021
  • Setup menu at Appearance » Menus and assign menu to Top Bar Navigation
Advertisement
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News
No Result
View All Result
NikolaNews
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News
No Result
View All Result
NikolaNews
No Result
View All Result
Home Learn to Code

Mercurial Tips

August 19, 2019
in Learn to Code
How to Change the WordPress Admin Login Logo
586
SHARES
3.3k
VIEWS
Share on FacebookShare on Twitter

While most of the world seems to be using git for version control, Mozilla continues to use Mercurial (hg) to manage the Firefox source code. As a git and GitHub lover, it took me a while to get used to Mercurial. I don’t consider myself a hg expert but I know enough to complete 99% of the tasks required…which is probably about how much I know about git. Just enough to be dangerous, I guess.

This post will cover some of the tasks I frequently complete with Mercurial.

You might also like

Use Touch ID for sudo on Mac

How to Install a NPM Module from GitHub Branch

How to Push to a Git Remote Branch of a Different Name

Create a Commit with Message

You can add -m to add the message from command line instead of entering VIM or your desired editor:

hg commit -m "Bug #### - This is the commit message"

This is the same format as git.

Import a Patch

Mercurial lets you import patches from both local files and URLs:

# From local file
hg import /path/to/code.patch

# From URL
hg import https://bugzilla.mozilla.org/attachment.cgi?id=32894.patch

Get Latest Public Commits

The commits you make locally are in “draft” status; “public” commits are commits in the official repository. You can pull new commits from the main repository with pull:

# Pull down new commits and check out latest
hg pull && hg update --clean

# Only checkout latest
hg checkout "last(public())"

Delete All Untracked Files

Mercurial generates .orig files when you revert changed files, just in case you need those changes in the future. When you want to get rid of untracked files, you can use purge:

hg purge

Rebase a Commit

The rebase option lets you provide a variety of options:

# Provide a source and destination revision (123 onto 200)
# hg rebase -s <REV> -d <REV>
hg rebase -s 12345 -d 12400

# Rebase the currently checked out revision onto a destination
hg rebase -d 200

# Rebase onto the last public commit
hg rebase -s 12345 -d 'last(public())`

Delete a Commit

Sometimes you need to remove a commit:

# hg strip <REV>
hg strip 12345

Checkout a Commit that Contains a Search String

In the case that my patch gets reviewed and requires updates, I need to find the commit by the bug number which I provided in the commit message:

# Format: hg checkout "grep(SEARCH STRING)"
# Find the revision with message containing a search string
hg checkout "grep(Bug 1565318)"

Create and Delete Bookmarks

Bookmarks are the closest thing to git branches — you can apply a text-based reference label to a commit:

# Create a bookmark
hg bookmark bug-12345

# Delete a bookmark -- doesn't delete commit
hg bookmark -d bug-12345

Change a Commit Author

Every once in a while I need to pull a patch from GitHub into my Mozilla Central repository for committing, but I don’t want to steal credit for a contributor’s brilliant patch.

hg commit -u "User Name <username@domain.com>" -m "The commit message"

Manage History

The histedit directive provides a listing of commits from a given parent and allows you to edit their commit messages, merge commits, drop commits, reorder commits, and more:

hg histedit

Truth be told, if you learn these commands, you’ll be able to do mostly all you’ll ever need to with Mercurial. I appreciate that Mercurial and git are incredibly powerful yet the basics are all 99% of developers need!

Feel free to ask questions in this post — I’ll add more commands as questions are asked!

Credit: DavidWalsh By: David Walsh

Previous Post

Malicious Android photography, gaming apps downloaded 8 million times from Google Play

Next Post

GoExpedi Launches Innovative New Applications Incorporating AI and Machine Learning

Related Posts

How to Change the WordPress Admin Login Logo
Learn to Code

Use Touch ID for sudo on Mac

March 1, 2021
How to Change the WordPress Admin Login Logo
Learn to Code

How to Install a NPM Module from GitHub Branch

February 12, 2021
How to Change the WordPress Admin Login Logo
Learn to Code

How to Push to a Git Remote Branch of a Different Name

February 9, 2021
How to Change the WordPress Admin Login Logo
Learn to Code

Fix “no such file or directory, scandir”

February 8, 2021
How to Change the WordPress Admin Login Logo
Learn to Code

Confessions of a Web Developer XVIII

February 3, 2021
Next Post
GoExpedi Launches Innovative New Applications Incorporating AI and Machine Learning

GoExpedi Launches Innovative New Applications Incorporating AI and Machine Learning

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

Plasticity in Deep Learning: Dynamic Adaptations for AI Self-Driving Cars

Plasticity in Deep Learning: Dynamic Adaptations for AI Self-Driving Cars

January 6, 2019
Microsoft, Google Use Artificial Intelligence to Fight Hackers

Microsoft, Google Use Artificial Intelligence to Fight Hackers

January 6, 2019

Categories

  • Artificial Intelligence
  • Big Data
  • Blockchain
  • Crypto News
  • Data Science
  • Digital Marketing
  • Internet Privacy
  • Internet Security
  • Learn to Code
  • Machine Learning
  • Marketing Technology
  • Neural Networks
  • Technology Companies

Don't miss it

Cloudera: An Enterprise-Level Play On Machine Learning And Big Data – Seeking Alpha
Machine Learning

Cloudera: An Enterprise-Level Play On Machine Learning And Big Data – Seeking Alpha

March 3, 2021
The Symbolic World: Raising A Turing’s Child Machine (1/2) | by Puttatida Mahapattanakul | Feb, 2021
Neural Networks

The Symbolic World: Raising A Turing’s Child Machine (1/2) | by Puttatida Mahapattanakul | Feb, 2021

March 3, 2021
Top 10 ‘Brand Guardian’ Most Famous, Most Reputable CEOs
Marketing Technology

Top 10 ‘Brand Guardian’ Most Famous, Most Reputable CEOs

March 3, 2021
Linux Mint may start pushing high-priority patches to users
Internet Security

Linux Mint may start pushing high-priority patches to users

March 3, 2021
Microsoft Ignite Data and Analytics roundup: Platform extensions are the key theme
Big Data

Microsoft Ignite Data and Analytics roundup: Platform extensions are the key theme

March 3, 2021
An open-source machine learning framework to carry out systematic reviews
Machine Learning

An open-source machine learning framework to carry out systematic reviews

March 3, 2021
NikolaNews

NikolaNews.com is an online News Portal which aims to share news about blockchain, AI, Big Data, and Data Privacy and more!

What’s New Here?

  • Cloudera: An Enterprise-Level Play On Machine Learning And Big Data – Seeking Alpha March 3, 2021
  • The Symbolic World: Raising A Turing’s Child Machine (1/2) | by Puttatida Mahapattanakul | Feb, 2021 March 3, 2021
  • Top 10 ‘Brand Guardian’ Most Famous, Most Reputable CEOs March 3, 2021
  • Linux Mint may start pushing high-priority patches to users March 3, 2021

Subscribe to get more!

© 2019 NikolaNews.com - Global Tech Updates

No Result
View All Result
  • AI Development
    • Artificial Intelligence
    • Machine Learning
    • Neural Networks
    • Learn to Code
  • Data
    • Blockchain
    • Big Data
    • Data Science
  • IT Security
    • Internet Privacy
    • Internet Security
  • Marketing
    • Digital Marketing
    • Marketing Technology
  • Technology Companies
  • Crypto News

© 2019 NikolaNews.com - Global Tech Updates