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

你离开我真会死。 提交于 2019-12-11 04:25:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!