hg 恢复strip删除的版本

11th April 2016

  Filed under: Best PracticesFeatured
  Comments: Comments Off on Recovering stripped files when using Mercurial

If you accidentally strip a patch and do not have a backup for it, you can still recover your files using Mercurial. To recover your files:

  1. Open a Microsoft Windows Command Prompt window.
  2. Navigate to the project folder where you stripped the files.
  3. Run the dir
  4. Navigate to the .hg folder where Mercurial stores all relevant project files.
  5. Run the dir command again.
  6. Navigate to the strip-backup folder where Mercurial stores the backup bundles of stripped patches.
  7. Run the dir command again. Multiple files display in the directory that use the <hash>-hg format. They are the backup bundles of stripped patches.
    post1
  8. Use Windows Explorer to find the required file. Open the strip-backup folder in Windows Explorer, and sort by Date modified descending. Unless the necessary backup bundle is already known, NexJ recommends that you restore the bundles in reverse chronological order starting from the most recent bundle.
    post2
  9. Navigate back to the project folder.
  10. To restore a bundle, run hg unbundle .hg\strip-backup\<bundle_file_name>. The hg executable can be found in <NexJ_Studio_installation_folder>\plugins\
    nexj.oss.hgbinaries_win32_<version>\os\win32
    . You may want to add it to the PATH environment variable to make it accessible globally.
    post3
  11. Synchronize the project in NexJ Studio to see the restored patch. If the restored patch is not the one needed, then continue restoring the patches in reverse chronological order until the required patch is retrieved.
    post4

Note: You may restore the backup bundles in any order, instead of using reverse chronological order. However, it may not be safe to do so. You may end up attempting to restore a backup bundle, which has a dependency on another backup bundle that has not been restored. In this case, you will get an error.
post5

转载于:https://my.oschina.net/yukong/blog/884424

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值