Adam Rackis
Adam Rackis

Reputation: 83358

TortoiseHG - rename folder --> new folder

I created a branch in Kiln, and have been using it to do work in a folder called contactsmanager.

Now though, after a change in plans, instead of merging my changes right back into the trunk, what I want is to rename the contactsmanager folder to just contacts.

I want Tortoise to treat the old contactsmanager folder not as deleted or renamed, but just, plain, missing.

I want to pull down from the trunk and get the old contactsmanager, and have it side by side with the newly (renamed) contacts folder, and, when it looks right, push this structure to the trunk (contactsmanager and contacts side by side.)

The problem is, TortoiseHG seems certain that the old contactsmanager folder is deleted, as the screenshot shows. I've tried highlighting all the old contactsmanager stuff, right clicking and selecting "forget", to no avail.

Is there a way to achieve this in Tortoise? The workaround is fairly clear: make a copy of the old contactsmanager folder on the trunk, push my changes over, rename on the trunk, restore manually the older contactsmanager, and be good to go.

I'm hoping there's a direct way, though.

enter image description here

Upvotes: 3

Views: 3464

Answers (1)

Martin Geisler
Martin Geisler

Reputation: 73748

Let me see if I can clear up a few things about the transitions between different file statuses in Mercurial:

  • Clean → Removed: with hg remove, hg rename, or hg forget.

  • Removed → Clean: with hg revert

So renaming, removing, and forgetting a file all result in the same thing: the file is scheduled for removal in the next commit. The different commands will of course have different effects in the working copy:

  • hg remove: file is deleted from your working copy

  • hg rename: file is deleted, but can now be found under another name

  • hg forget: file is still there in the working copy

The hg forget command will in no case bring a file back to life, that is what hg revert is for.

So if I've understood you correctly, then you want to hg revert the entire contactsmanager folder to bring the files back to a clean state (that is probably what you mean by "I want to pull down from the trunk and get the old contactsmanager"). The files in the contacts folder will remain unknown to Mercurial — you can add them as normal.

If you do this, then there wont be any "link" between the files in contactsmanager and contacts and the folders will live side by side as you ask for. The missing link will mean that you wont be asked to merge changes made in one folder into the other folder. If you do want this, then you can hg copy the contactsmanager folder to contents. A copy will make Mercurial merge changes made in contactsmanager into contacts. See my answer about hg copy for more information.

Upvotes: 3

Related Questions