Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Github和Kill之间的自动同步_Git_Mercurial_Github_Kiln - Fatal编程技术网

Github和Kill之间的自动同步

Github和Kill之间的自动同步,git,mercurial,github,kiln,Git,Mercurial,Github,Kiln,我是一名前端设计师,没有大型编程背景。我做CSS/html和一些JavaScript。我们公司的技术团队已经将版本控制从Git(github)转移到Mercurial(Kill)。他们的唯一原因是获得了回转窑的代码审查功能(我们使用Fogbugz并喜欢它) 问题是,在我们的版本控制中工作的前端程序和非开发人员一直在工作。我们使用hg git在Heroku上部署,并习惯于使用git(从未与其他版本控制系统一起使用)。 我确信Mercurial是一个伟大的工具,但我必须得出结论,我们在问题和错误上花

我是一名前端设计师,没有大型编程背景。我做CSS/html和一些JavaScript。我们公司的技术团队已经将版本控制从Git(github)转移到Mercurial(Kill)。他们的唯一原因是获得了回转窑的代码审查功能(我们使用Fogbugz并喜欢它)

问题是,在我们的版本控制中工作的前端程序和非开发人员一直在工作。我们使用hg git在Heroku上部署,并习惯于使用git(从未与其他版本控制系统一起使用)。 我确信Mercurial是一个伟大的工具,但我必须得出结论,我们在问题和错误上花费了太多的时间

我的想法是:有没有办法在github上使用git,然后将所有提交等同步到Mercurial(窑)?然后我们就可以使用git了,并且仍然拥有Kill的代码审查功能


希望你能帮忙。我很想回到我们的技术团队,提出一个解决方案;)

也许您可以使用git post commit钩子将更改推送/同步到Kill?

与学习Mercurial相比,您设置的任何同步都更容易出错。Git和Mercurial都是很好的工具,而且非常相似,因此如果你不用一个任务一个任务地做,而是花上一个小时阅读它们之间的差异,那么你就可以毫无问题地来回切换

不太好的同步选项有:git hg、hgit和Mercurial的convert扩展,以及Mercurial对git子存储库的支持,但您会对其中任何一个感到遗憾,因为它们需要对这两个工具都有比单独使用它们更深入的理解


要么让开发人员切换回来,要么让他们为您重写部署内容,但不要在同一家公司内跨部门工作。

您也可以设置一个从Kill同步到Git的程序。

今天,Kill v3是使用Kill Harmony发布的,它具有本机Git支持(事实上,它允许Mercurial和Git在同一个repo上!)

作为Mercurial的粉丝,我编写了一个脚本,定期与GitHub同步窑回购,这样我就可以在GitHub上托管代码,但仍然每天只使用Mercurial

的最新版本,但为了方便起见,我已将当前版本粘贴在此处

<#
.SYNOPSIS
    Script to sync a GitHub repo to Kiln to allw GitHub contributions without using Git (use Hg on your Kiln repos!).
.DESCRIPTION
    Create a branch repo in Kiln specifically for for the GitHub sync and run this PS script periodically (PoSh v3
    scheduled jobs make this easy).

    Merge the GitHub branch repo (using Hg!) into your main repo periodically, then push back to the GitHub branch
    once done. This will be sync'd back to GitHub when the script next runs.

    Avoid simultaneous changes in the GitHub repo and the Kiln GitHub branch repo, as we don't want the automated
    script merging (esp. as they could conflict).
.EXAMPLE
    Sync-GitRepositories `
        "$kilnBase/Misc/Group/NewSyncTest-GitHub.git" `
        "$githubBase/NewSyncTest.git" `
        "$tempSyncBase\Scripted"
#>
function Sync-GitRepositories
{
    param(
        [Parameter(Mandatory)]
        [string]$gitRepo1,
        [Parameter(Mandatory)]
        [string]$gitRepo2,
        [Parameter(Mandatory)]
        [string]$tempSyncPath,
        [string]$gitExecutable
    )

    # If we weren't given a path to git, assume it's in the path.
    if (!$gitExecutable)
        { $gitExecutable = "git" }

    # Clone the Kiln Github branch repo if we haven't already got a copy.
    if (!(Test-Path $tempSyncPath))
    {
        & $gitExecutable clone $gitRepo1 $tempSyncPath | Out-Default
        Push-Location $tempSyncPath

        # Add a remote for the GitHub repo that we're syncing with.
        & $gitExecutable remote add github $gitRepo2 | Out-Default
    }
    else
    {
        Push-Location $tempSyncPath
    }

    # Fetch changes from the Kiln GitHub branch repo and merge them in.
    # Note: Use FastForward-Only to avoid merging (this is automated!), if changes are made to
    # both GitHub and Kiln GitHub branch simultaneously, we'll have to manually resolve it.
    # Errors from this script should be emailed to the user!
    # Note: Always use -q because Git writes progress to STDERR! #WTF
    & $gitExecutable fetch origin -q | Out-Default
    & $gitExecutable merge origin/master --ff-only -q | Out-Default

    # Repeat the process with any changes from GitHub.
    & $gitExecutable fetch github -q | Out-Default
    & $gitExecutable merge github/master --ff-only -q | Out-Default

    # Push changes back to both Kiln GitHub branch repo and GitHub repo.
    & $gitExecutable push origin : -q | Out-Default
    & $gitExecutable push github : -q | Out-Default

    Pop-Location
}

函数同步存储库
{
param(
[参数(强制性)]
[字符串]$gitRepo1,
[参数(强制性)]
[字符串]$gitRepo2,
[参数(强制性)]
[字符串]$tempSyncPath,
[string]$git可执行文件
)
#如果没有给我们git的路径,假设它在路径中。
如果(!$git)
{$gitExecutable=“git”}
#克隆Github分支回购协议(如果我们尚未获得副本)。
if(!(测试路径$tempSyncPath))
{
&$gitRepo1$tempSyncPath |输出默认值
推送位置$tempSyncPath
#为我们正在同步的GitHub repo添加远程。
&$gitExecutable远程添加github$Gitrep2 |输出默认值
}
其他的
{
推送位置$tempSyncPath
}
#从GitHub分支repo获取更改并将其合并到。
#注意:如果对进行了更改,请仅使用快进以避免合并(这是自动的!)
#GitHub和GitHub分支同时出现,我们必须手动解决它。
#此脚本中的错误应通过电子邮件发送给用户!
#注意:始终使用-q,因为Git将进度写入STDERR!#WTF
&$GIT可执行文件获取原点-q |输出默认值
&$GIT可执行文件合并源/主--仅限ff-q |输出默认值
#对GitHub的任何更改重复此过程。
&$github-q |输出默认值
&$github/master可执行文件合并github-ff-only-q | Out默认值
#将更改推回到GitHub分支回购和GitHub回购。
&$GIT可执行推送原点:-q |输出默认值
&$github:-q |输出默认值
流行位置
}

谢谢,我会调查的:)很有趣。我一点也不介意否决投票,但我不介意一个解释:)我也是来学习的!我对否决票也很好奇——从我天真的角度看,这似乎比“正确的答案”更有帮助?有人得到解释吗?我刚才投了更高的票…也投了更高的票。。。这么简单的解决方案,我为自己不得不用谷歌搜索它而生气。另外,它是在窑外抽象的(我不使用)。尽管否决票可能是因为缺乏榜样;)谢谢@DaveLasley,这是我在将东西粘贴到git时继续做的事情。这种简单性经常被证明是一种胜利。