同步Mercurial存储库的集合

同步Mercurial存储库的集合

本文介绍了同步Mercurial存储库的集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络共享上有一个Mercurial存储库.要启用脱机工作,我希望在笔记本电脑上获得此收藏集的本地副本,并希望在在线时能够轻松同步两者.

I have a collection of Mercurial repositories on a network share. To enable offline work, I want a local copy of this collection on my laptop, and an easy way to synchronize the two when I'm online.

为此,我编写了一个快速脚本,该脚本会自动将每个本地存储库与相应的远程存储库(推和拉)进行同步,但是缺少一些理想的功能:

For this, I wrote a quick script that automatically synchronizes each local repository with the corresponding remote repository (push and pull), but it's missing a couple of desirable features:

  • 自动将新存储库从本地集合克隆到远程集合(反之亦然)
  • 组织(移动/重命名)本地存储库并在下次下次同步时也将更改应用到远程端的功能
  • 具有同步hg strip和其他重写存储库历史记录的命令的功能
  • hgwebdir集合甚至Bitbucket同步的能力
  • automatic cloning of new repositories from the local to the remote collection (and vice versa)
  • the ability to organize (move/rename) a local repository and have the change being applied on the remote side as well, the next time I synchronize
  • the ability to synchronize hg strip and other commands that rewrite repository history
  • the ability to synchronize against a hgwebdir collection or even Bitbucket

是否存在任何提供某些(或全部)这些功能的解决方案?

Are there any existing solutions that provide some (or all) of these features?

推荐答案

据我所知,没有这样的东西.在存储库之间来回移动变更集的最安全方法始终是hg pushhg pull,并且这些命令都不能在多个源存储库或目标存储库上进行操作.

To my knowledge nothing like this exists. The safest way to move changesets back and forth between repositories is always hg push and hg pull and none of those command operate on more than one source or destination repository.

出于备份目的,我之前已经做过类似的事情:

For backup purposes I've done something like this before:

for thedir in $(find . -type d -name .hg) ; do
   repopath=$(dirname $thedir)
   hg push $repopath ssh://mybackupserver//path/to/backups/$(basename $repopath)
done

将所有本地存储库推送到异地备份.从理论上讲,您既可以进行推拉操作,也可以进行init/clone操作,但是您很快就会开始遇到边缘ccase.

which pushes all local repos to off site backups. In theory you could do both push and pull and if necessary a init/clone, but you'll start running into edge ccases pretty quickly.

这篇关于同步Mercurial存储库的集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 15:38