Discard all and get clean copy of latest revision?

后端 未结 5 2137
Happy的楠姐
Happy的楠姐 2021-01-29 19:21

I\'m moving a build process to use mercurial and want to get the working directory back to the state of the tip revision. Earlier runs of the build process will have modified so

5条回答
  •  没有蜡笔的小新
    2021-01-29 19:50

    hg status will show you all the new files, and then you can just rm them.

    Normally I want to get rid of ignored and unversioned files, so:

    hg status -iu                          # to show 
    hg status -iun0 | xargs -r0 rm         # to destroy
    

    And then follow that with:

    hg update -C -r xxxxx
    

    which puts all the versioned files in the right state for revision xxxx


    To follow the Stack Overflow tradition of telling you that you don't want to do this, I often find that this "Nuclear Option" has destroyed stuff I care about.

    The right way to do it is to have a 'make clean' option in your build process, and maybe a 'make reallyclean' and 'make distclean' too.

提交回复
热议问题