0

mercurial-server 在 Ubuntu 12.04 LTS 上运行

myserver@ip:/etc$ hg --version
    Mercurial Distributed SCM (version 2.0.2)
myserver@ip:/etc$ dpkg -s mercurial-server
    Package: mercurial-server
    Version: 1.2-1 
    ....

myserver@ip:/etc/mercurial-server/remote-hgrc.d$ ls -ltr
    total 12
    -rw-r--r-- 1 root root 180 Oct 10  2011 logging.rc
    -rw-r--r-- 1 root root 139 Oct 10  2011 access.rc
    -rw-r--r-- 1 root root  74 Mar 13 22:14 check.rc
myserver@ip:/etc/mercurial-server/remote-hgrc.d$ cat check.rc
    [hooks]
    pretxncommit.author_check = /SOURCE/mercurial-server/validate.sh

#manually added here too    
myserver@ip:/etc/mercurial-server/remote-hgrc.d$ cat ~hg/repos/hgadmin/.hg/hgrc
    # WARNING: when these hooks run they will entirely destroy and rewrite
    # ~/.ssh/authorized_keys

    [extensions]
    hgext.purge =

    [hooks]
    changegroup.aaaab_update = hg update -C default > /dev/null
    changegroup.aaaac_purge = hg purge --all > /dev/null
    changegroup.refreshauth = python:mercurialserver.refreshauth.hook
    pretxncommit.author_check = /SOURCE/mercurial-server/validate.sh

myserver@ip:/etc/mercurial-server/remote-hgrc.d$ cat /SOURCE/mercurial-server/validate.sh
    #!/bin/bash
    echo "REMUSR:$REMOTE_USER"
    echo "ATHR:`hg tip --template "{author}\n"`b"
    exit 1  

myserver@ip:~$ sudo -u hg cat ~hg/.ssh/authorized_keys
    no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/usr/share/mercurial-server/hg-ssh root/user1/user1.pub" ssh-rsa AAAAB3xOMN8ZiF user1@server.com
    no-pty,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/usr/share/mercurial-server/hg-ssh users/user2/user2.pub" ssh-rsa AAAAB3N..0HchQQw== user2@server.com

在此之后从本地机器(Windows)我克隆了一个测试项目,更改,提交,推送并且它成功没有任何错误或消息。我尝试使用初始用户/密钥和通过 hgadmin push 添加的用户/密钥

 D:\hg\testproj>hg push
   pushing to ssh://hg@myserver.com/testproj
   searching for changes
   remote: adding changesets
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
4

1 回答 1

0

适用于

$ cat check.rc 
[hooks]
pretxnchangegroup.author_check = /SOURCE/mercurial-server/validate.sh

不使用 pretxncommit

于 2014-01-15T13:56:12.863 回答