1

Suppose I have made a change to a file, hg status show it as modified.

Now I want to commit. Before I can do so I accidentially hg remove my file. Mercurial now would remove my file on the next commit, hg revert would retain it from removal, my changes would be lost however.

Is exporting a patch and then importing it on top of a MQ my only option to put my file back into "modified" state?

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
Johannes Rudolph
  • 35,298
  • 14
  • 114
  • 172

1 Answers1

2

I am not sure about that but try adding it back with hg add.

And you can simply export and apply a patch without MQ.

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
artemb
  • 9,251
  • 9
  • 48
  • 68
  • i know, however MQ lets me manipulate my "commit" before actually doing a real commit, importing a patch always results in a commit. – Johannes Rudolph Sep 25 '09 at 12:31
  • This is the correct answer. Using `hg add` on a file that is scheduled to be removed from tracking will undo the remove and leave the contents untouched. – Steve Losh Sep 25 '09 at 12:44
  • A note on your comment, Johannes Rudolph: "importing a patch always results in a commit". You can avoid that by doing `hg import --no-commit` – Ry4an Brase Sep 25 '09 at 14:50
  • im more and more realizing im a mercurial noob :-) seemed so easy in the beginning, and after thinkin about it, indeed it _is_ simple! Mercurial ftw :-) – Johannes Rudolph Sep 25 '09 at 18:04