2011-03-30 12 views
9

के बीच स्वचालित सिंक मैं एक फ्रंटेंड डिजाइनर हूं और इसमें बड़ी प्रोग्रामिंग पृष्ठभूमि नहीं है। मैं सीएसएस/एचटीएमएल और जावास्क्रिप्ट का एक बिट करता हूँ। हमारी कंपनी की तकनीकी टीम ने गिट (गीथूब) से Mercurial (Kiln) तक हमारे संस्करण नियंत्रण को स्थानांतरित कर दिया है। उनके लिए एकमात्र कारण किल की कोड समीक्षा सुविधा प्राप्त करना है (हम फोगबगज़ का उपयोग करते हैं और इसे प्यार करते हैं)।गीथब और किल

समस्या यह है कि हमारे संस्करण नियंत्रण में काम करने वाले अग्रदूत और गैर-डेवलपर्स हर समय मजाक कर रहे हैं। हम हेरोकू पर तैनात करने के लिए एचजी-गिट का उपयोग करते हैं और गिट के लिए उपयोग किए जाते हैं (अन्य संस्करण नियंत्रण प्रणाली के साथ कभी काम नहीं किया)। मुझे यकीन है कि Mercurial एक अच्छा उपकरण है, लेकिन मुझे यह निष्कर्ष निकालना होगा कि हम समस्याओं और त्रुटियों पर बहुत अधिक समय बिताते हैं।

मेरा विचार था: क्या गिटूब पर गिट का उपयोग करने का कोई तरीका है और फिर सभी काम आदि को Mercurial (Kiln) में सिंक करें? फिर हम गिट का उपयोग करेंगे और अभी भी भट्ठी की कोड समीक्षा विशेषताएं हैं।

आशा है कि आप मदद कर सकते हैं। मुझे समाधान के साथ हमारी तकनीकी टीम में वापस आना अच्छा लगेगा;)

उत्तर

8

आपके द्वारा स्थापित कोई भी सिंक्रनाइज़ेशन केवल Mercurial सीखने से अधिक त्रुटि प्रवण होने जा रहा है। गिट और मर्कुरियल दोनों महान उपकरण हैं, और बहुत समान हैं, इसलिए अगर इसे टुकड़े करने के बजाए टुकड़े टुकड़े करने के बजाए आप अंतर के बारे में एक अच्छा घंटा बिताते हैं तो आप किसी भी समस्या के बिना आगे और पीछे स्विच करने में सक्षम होंगे।

तुल्यकालन के लिए नहीं-महान विकल्प हैं: Git-एचजी, hgit, और मर्क्युरियल की परिवर्तित विस्तार, और Git subrepositories के लिए मर्क्युरियल के समर्थन है, लेकिन आप उनमें से किसी पछताओगे क्योंकि वे दोनों का एक बड़ा समझ की आवश्यकता होती है जाएगा उनमें से किसी एक का उपयोग करने से उपकरण।

या तो डेवलपर्स को वापस स्विच करें या उन्हें आपके लिए अपनी तैनाती सामग्री को फिर से लिखने दें, लेकिन उसी कंपनी के भीतर स्ट्रैडलिंग को परेशान न करें।

2

शायद आप git-hg का उपयोग करके अपने परिवर्तन को पुश/सिंक करने के लिए गिट पोस्ट-प्रतिबद्ध हुक का उपयोग कर सकते हैं?

+0

धन्यवाद, मैं इसे देखूंगा :) – nikstep

+1

दिलचस्प। मैं बिल्कुल मत मानता हूं, लेकिन मुझे कोई स्पष्टीकरण नहीं होगा :) मैं भी सीखने के लिए यहां हूँ! –

+1

मैं भी नीचे वोट पर उत्सुक हूं - ऐसा लगता है कि मेरे बेवकूफ दृष्टिकोण से "सही एक" की तुलना में यह अधिक उपयोगी था? किसी को भी स्पष्टीकरण मिला है? मैंने अभी अपरिवर्तित किया है ... –

0

आप किल से गिट को सिंक्रनाइज़ करने के लिए Custom Web Hook in Kiln भी सेट कर सकते हैं।

3

आज किल वी 3 को किल हार्मनी के साथ लॉन्च किया गया था जिसमें देशी गिट समर्थन है (वास्तव में, यह एक ही रिपो पर Mercurial और Git दोनों को अनुमति देता है!)।

मर्कुरियल के प्रशंसक के रूप में, मैंने गिटहब के साथ समय-समय पर एक भट्ठी रेपो को सिंक करने के लिए एक स्क्रिप्ट लिखी ताकि मैं गिटहब पर अपना कोड होस्ट कर सकूं लेकिन फिर भी दैनिक आधार पर केवल Mercurial का उपयोग कर सकता हूं।

the PowerShell function is available as a Gist का नवीनतम संस्करण, लेकिन मैंने सुविधा के लिए यहां वर्तमान संस्करण चिपकाया है।

<# 
.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 
}