Mercurial AllPaths扩展
mercurial_all_paths的Python项目详细描述
一次推或拉到许多(或所有)路径。
1 Basic usage
执行:
hg pushall
推送到为存储库定义的所有远程。或:
hg pullall
按顺序从所有遥控器拔出。
还有:
hg incomingall hg outgoingall
可以提供标准的推/拉选项,例如:
hg pushall -f -B issue-13724 hg pullall -r stable --insecure
这些命令遍历由hg paths返回的所有路径。这个 通常意味着在 .hg/hgrc,但也处理Path Pattern路径。你可以 通过配置影响此行为,请参见下文。
2 Defining path groups
您可以定义和使用groups:
hg pushall -g publish
从publish组推送到所有路径(其中publish是 你选择的象征性名称)。或:
hg pullall -g shared
从shared组中的所有路径提取。
定义这样一个组有两种方法:
在[all_paths]节中(在^{tt3}中)定义适当的条目$ 或者在您的全局~/.hgrc中。例如:
[all_paths] group.publish = bitbucket github backup
(路径别名bitbucket、github和backup必须 以某种方式定义)。
(遗留方法)将同名的节放入.hg/hgrc, 定义所有路径。例如:
[publish] bitbucket = ssh://hg@bitbucket.org/ludovicchabant/piecrust github = git+ssh://git@github.com:ludovicchabant/PieCrust.git backup = ssh://ludo@backup.local/piecrust
语法与标准[paths]节中的语法相同,只是 用组的名称命名分区。
注意
注意避免与有意义的名字发生冲突 变化无常。例如,web将是一个错误的名称,[web] 节配置hg serve行为,并且ui将是 fatal as[ui]配置各种基本mercurial设置。
我推荐前一种方法,因为它避免了冲突的风险, 使全局定义组变得容易,而不是为 每个存储库(如果您使用Path Pattern,则特别方便),并且 更紧凑。
也为incomingall和outgoingall处理组,但是 必须使用long--group选项(-g已被 标准Mercurial,表示以^{TT24}$diff格式报告:
hg outgoingall --group publish
3 Configuration
可以使用 全局(~/.hgrc)或存储库级别(.hg/hgrc)配置文件:
[all_paths] prioritize = platon department ignore = bitbucket production group.publish = github bitbucket group.backup = homebackup awsbackup
prioritize影响顺序,定义要 先处理(如果存在)。这对^{tt29}非常有用$ 从本地快速计算机中提取,然后从Bitbucket中提取 服务器意味着节省一些时间和流量。所以:
prioritize = platon department
意思是:如果名为platon的路径存在,请先处理它,然后 名为department的路径,然后才跟随其他路径。
ignore列出应该忽略的路径,这些远程将 被跳过。所以:
ignore = bitbucket production
意味着hg pullall或hg pushall不应使用 bitbucketpath(在我的例子中,因为这是http远程的,而且 也更可取bitssh``configured), and ``productionpath(作为 在那里,我更喜欢只按特定需求拉和推)。
这两个设置只影响default命令(运行 没有-g GROUP选项)。如果是组,则处理项目 按组定义中指定的顺序。
group.«NAME»如前所述为-g «NAME»定义组。
4 Installation
4.1 From PyPi
如果您有工作pip或easy_install:
pip install --user mercurial_all_paths
或者:
sudo pip install mercurial_all_paths
然后激活:
[extensions] mercurial_all_paths =
要升级,请使用--upgrade选项重复相同的命令 示例:
pip install --user --upgrade mercurial_all_paths
4.2 From source
如果您没有pip,或者希望更密切地关注开发:
克隆此存储库和mercurial_extension_utils并将 它们位于同一目录中,例如:
cd ~/sources hg clone https://bitbucket.org/Mekk/mercurial-extension_utils/ hg clone https://bitbucket.org/Mekk/mercurial-all_paths/
更新到最新标签,
激活方式:
[extensions] mercurial_all_paths = ~/sources/mercurial-all_paths/mercurial_all_paths.py
升级,拉和更新。
注意目录名很重要。参见mercurial_extension_utils了解 这类安装的详细说明。
6 Development
在Bitbucket上跟踪开发,请参见
http://bitbucket.org/Mekk/mercurial-all_paths/
原始存储库,由Ludovic Chabant维护(在 时刻):
https://bitbucket.org/ludovicchabant/allpaths
7 Additional notes
有关此扩展的信息也可用 在Mercurial Wiki上:http://mercurial.selenic.com/wiki/AllPathsExtension