Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1025679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:57:52+00:00 2026-05-16T11:57:52+00:00

I decided to rename some directories in my home/hobby Python package ( doc to

  • 0

I decided to rename some directories in my home/hobby Python package (doc to docs, test to tests, util to utils) because, now that I’ve thought more about it, I think the new names are more appropriate. My general thinking now is that if containers are named after their contents their names should be plural nouns.

Now that I’m ready for my next hg commit I’m wondering how to tell Mercurial about these directory name changes. I am new to RCS software in general and have only been using Mercurial for a couple months. When I run hg status it shows all the the files in these directories being removed and added, so I’m afraid if I just do a hg addremove I will loose all the change history for the files in these directories, or at the very least the change history will become fragmented and untraceable. I’ve come across the hg rename command, but the docs only discuss its use for individual files, not directories.

After further reading in Bryan O’Sullivan’s ‘Definitive Guide’ it appears that maybe rename can refer to directories.

So here’s what I’ve decided to try:

hg rename --after doc docs
hg rename --after test tests
hg rename --after util utils
hg status
hg addremove

Can anyone tell me if this is the accepted and preferred method for renaming directories in Mercurial, and if not, how should I do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:57:52+00:00Added an answer on May 16, 2026 at 11:57 am

    Since you’ve already renamed the directories, this is perfectly OK. (It would have saved you a manual step if you’d let Mercurial rename them for you: hg rename doc docs, etc. instead of doing it yourself then letting Mercurial know about it).

    If you don’t have any other files to check in, the hg addremove is superfluous. Look in the output of hg stat and you should only see lines beginning with ‘R’ (for doc/*, test/* and util/*) and ‘A’ (for docs/*, etc.)

    Finally, don’t forget to commit the changes.

    EDIT: Forgot to say… use hg log --follow to track changes across the rename.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Decided to use Apache's Common Configuration package to parse an XML File. I decided
I decided to try developing on python with django, while python is new to
I decided that the easiest way to rename the directory is through the REN
I started learning Common Lisp recently, and (just for fun) decided to rename the
At University we have VS 2005 and it has some refactoring tool like rename,
We're recently switched over to Log4J from JUL (java.util.Logging) because I wanted to add
I'm evaluating subversion's branch/merge capabilities, and I decided to do a simple test -
Working with ASP.NET MVC3, site is in beta and customer decided to rename one
How do I solve this chicken & the egg situation? I decided to rename
I decided to take the advice of the below and rework my question to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.