Unversion a TortoiseHg repository - mercurial

I am not an expert with version control systems, but I have a TortoiseHg (Mercurial) repository that I would like to unversion (remove it completely from version control), and possibly start a new version control history on it afterwards.
When I try to right-click a repository in an Explorer window, then under the "TortoiseHg" menu option there is no option to unversion or export the repository. I tried "Forget", but it just gives me the error message I describe in the next paragraph.
The reason that I want to remove the repository from version control is that TortoiseHg gives me an error message when I try to refresh the working folder. It says: "Failed to refresh", and lists a file with a "no match" message. I can't commit or merge with local etc. The repository has been untouched for half a year. I think I might have used an older version of TortoiseHg on it previously.

If you really want to "unversion" an entire repository just delete the .hg directory in the top level. That will leave all your files untouched, but will remove every trace of Mercurial history. Needless to say, this is not a reversible process.

Related

What does it mean that hg applies a patch to a working directory?

I am trying to use patches (to revive a corrupted repository) for the first time in my life. So I am not very well familiar with the concept, though I've read a bit. I am using TortoiseHg. I have created a patch (as a file), switched to another repository, and am trying to import it. I've asked THg to import it to Repository (other options are Shelf and Working Directory). When I click Import, THg says that the patch was imported to a working directory and the Console reads:
% hg import --verbose --"PATH\1059.patch"
applying PATH\1059.patch
applied to working directory
[command completed successfully DATE]
and I don't see any changes in the history window (no revision 1059). I wonder what I should do now or what I am doing wrong.
I am on Windows 10, TortoiseHg 4.9 with Mercurial 4.9.
When something is modified in your working directory by any means, it does not automatically affect anything in your repository. You have to manually commit such a change.
For the command line hg patch I think the default is to commit automatically. It may be that THG is using the --no-commit option. You could inspect this in the THG output / log window.
For the command line, there is also this note in the help import ...
first applies changes to the working directory (unless --bypass is
specified), import will abort if there are outstanding changes.
The THG Import window looks like this:
According to the docs
You have the choice of importing directly into the repository, the
working folder, a shelf file, or your patch queue.
I think if you inspect the "patches will be imported to" dropdown, it may be set to "working directory" or similar. If you change it to "Repository" I think it will commit for you.
Unless a better answer is provided, I have to assume that this behaviour is due to the corrupted repository: it is not observed when doing exactly the same with a non-corrupted repository.

TortoiseHg: Why do I always need to check "Discard local changes, no backup" to update working directory?

I have just pulled all incoming changes, committed everything, even pushed all my commits and even then the Update button is grayed out in Update Working directory window if I don't check the "Discard local changes, no backup" checkbox. Last time I did that, I lost all my work compared to the latest remote working directory.
Is it normal that that checkbox should always be checked or not? If not, then why is it like that in my TortoiseHg?
The behavior you are describing is what I get when I right-click on the changeset that is the parent of my Working Directory and try to update. Since the difference between my Working Directory and that parent is only my local changes, Update would do nothing unless I was going to discard the local changes.
If you are seeing that behavior when trying to update to other changesets farther back in the repo's history, you may have an issue. What version(s) are you using?
(Full disclosure: I have THg 2.4.1, hg 2.2.2, python 2.6.6, which are not the current versions, but I typically use hg from the console window.)

tortoisehg one step commit push - how to and where is the log file

Iam using win xp with Tortoisehg 2.3. I use bit bucket to backup my personal source code. (rarely for true version control, more as a source backup store). Right now I have to right click on my repo, select commit, then enter a commit message ( i choose to just copy the same message I used last time, there is a drop down to do this), then click commit. Then I again right click and select synchronize and go thru this option to finally push. I could use the workbench and do something similar. I want to optimize this process so I decided to just write a dos bat script to commit and push. When I push Tortoisehg spits out the hg command to the window and you can see it and cut and paste from here. For the commit it does not show what it is really doing under the hood. When I used TortoiseSVN long back I recall there was a logfile where all svn commands executed were stored for debugging. So I started searching for a TortoiseHg logfile.
Does anybody know:
1) Does Tortoisehg have a logfile somewhere where it stores all mercurial commands executed complete with all the command line options ?
2) Is there a better way to do a one step commit push (via Tortoisehg gui or bat or some addon/extension etc)?
regards
There's actually an option in TortoiseHg to do this:
From your Commit window click on the "Options" button next to the "Copy message" button you've been using.
This pops up a window with a few options - the third one down is "Push After Commit". Tick that.
Enter "default" into the box next to the option
Click "Save in Repo" so that it is saved for next time
Now it will push to the default push target every time you commit from TortoiseHg. One thing to note is that this won't result in an automatic push if you commit from the command line whereas Martin's solution will.
1) Does Tortoisehg have a logfile somewhere where it stores all mercurial commands executed complete with all the command line options ?
TortoiseHg is actually not very related to TortoiseSVN — the two projects share almost no code and are developed by different groups. So I don't think that there is a log file for TortoiseHg even though TortoiseSVN has one.
2) Is there a better way to do a one step commit push (via Tortoisehg gui or bat or some addon/extension etc)?
You could setup a post-commit hook. Add this to the .hg\hgrc file for your repository (create the file as needed):
[hooks]
post-commit = hg push
That way you will run hg push after every commit, even when the commit is done from TortoiseHg.

Mercurial and online sharing - how to proceed

A noob question... i think
I use Mercurial for my project on my laptop. How do i submit the project to an online server like codeplex?
I'm using tortoisehg and i cant find the upload interface for submit the project online...
From the command line, the command is:
hg push <url>
to push changes a remote repository.
In TortoiseHg, this is accessed through the "Synchronize" function, which seems to show up if you right-click in a Windows Explorer window but not on any file. It's also available in the workbench; the icon is 2 arrows pointing in a circle.
For these things, I find the best way to go is to use the command line interface - TortoiseHG is OK if you need to perform some common operations from the file browser, and it's a nice tool to visualize some aspects of your repository, but it doesn't implement all of mercurial's features in full detail, and it renames and bundles some operations for no apparent reason.
I don't know how things work at codeplex, but I assume it is similar to bitbucket or github, in which case here's what you'd do:
Create an empty repository on the remote end (codeplex / bitbucket / ...).
Find the remote repository's URL - for bitbucket, it is https://bitbucket.org/yourname/project, or ssh://hg#bitbucket.org/yourname/project.
From your local repository, commit all pending changes, then issue the command: hg push {remote_url}, where {remote_url} is the URL of the remote repository. This will push all committed changes from your local repository to the remote repository.
Since the remote's head revision (an empty project) is the same as the first revision in your local copy (because all hg repositories start out empty), mercurial should consider the two repositories related and accept the push.
For an introductory guide to command-line mercurial, I recommend http://hginit.com/

How can I see incoming changesets using hg4idea?

When using IntelliJ with Subversion, there is a view called "Incoming" that lets me see incoming changesets from the remote repository. With the Mercurial command line, there is an equivalent command hg in. I like this command because I can see what's coming before pulling it. This view seems to be missing from the IntelliJ-Mercurial integration; my "Changes" window only has one tab called "Changes." Is there a view for this somewhere?
As of IntelliJ IDEA 11.0, it's still not possible to see "incoming" or "repository" changes with either mercurial or git repositories the way you can with subversion ones.
If you look at the online help for IDEA 11.0 http://www.jetbrains.com/idea/webhelp/local-committed-and-incoming-changes.html you'll see a specific note:
"Repository and incoming changes are not supported by Git and Mercurial integrations."
There is an open issue in the IDEA bug tracker http://youtrack.jetbrains.net/issue/IDEA-73130 reported in August 2011 but without any apparent plans for a fix.