问题
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.
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/55655699/what-does-it-mean-that-hg-applies-a-patch-to-a-working-directory