相关疑难解决方法(0)

阻止推动者破坏我的中央 Mercurial 存储库

我正在运行中央 mercurial 存储库,我知道如果远程用户试图将多个“头”强制连接到我的中央存储库,则正常的“推送”命令将停止。目的是远程用户在尝试再次推送之前应该先拉取和合并。

但是,使用hg push --force将覆盖它。我想阻止这种行为。

我目前正在使用hgwebdir.cgi加上一些 apache-auth 的东西来限制用户拉和推的能力。

编辑:一个 pretxnchangegroup 钩子解决了这个问题。钩子工作:

#!/bin/bash
# force-one-head
# add the following to <repository>/.hg/hgrc :
# [hooks]
# pretxnchangegroup.forceonehead = /path/to/force-one-head

if [[ `hg heads -q | wc -l` -gt 1 ]]; then
    echo "There are multiple heads."
    echo "Please 'hg pull' and get your repository up to date first."
    echo "Also, don't 'hg push --force' because that won't work either."
    exit 1
fi
Run Code Online (Sandbox Code Playgroud)

mercurial apache-2.2

7
推荐指数
1
解决办法
2140
查看次数

标签 统计

apache-2.2 ×1

mercurial ×1