• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python commands.clone函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mercurial.commands.clone函数的典型用法代码示例。如果您正苦于以下问题:Python clone函数的具体用法?Python clone怎么用?Python clone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了clone函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _get_repo

 def _get_repo(self, create, src_url=None, update_after_clone=False):
     """
     Function will check for mercurial repository in given path and return
     a localrepo object. If there is no repository in that path it will
     raise an exception unless ``create`` parameter is set to True - in
     that case repository would be created and returned.
     If ``src_url`` is given, would try to clone repository from the
     location at given clone_point. Additionally it'll make update to
     working copy accordingly to ``update_after_clone`` flag
     """
     try:
         if src_url:
             url = str(self._get_url(src_url))
             opts = {}
             if not update_after_clone:
                 opts.update({"noupdate": True})
             try:
                 clone(self.baseui, url, self.path, **opts)
             except urllib2.URLError:
                 raise Abort("Got HTTP 404 error")
             # Don't try to create if we've already cloned repo
             create = False
         return localrepository(self.baseui, self.path, create=create)
     except (Abort, RepoError), err:
         if create:
             msg = "Cannot create repository at %s. Original error was %s" % (self.path, err)
         else:
             msg = "Not valid repository at %s. Original error was %s" % (self.path, err)
         raise RepositoryError(msg)
开发者ID:lukaszb,项目名称:vcs,代码行数:29,代码来源:hg.py


示例2: main

def main(argv):
    # Find destination directory based on current file location
    destdir = os.path.abspath(os.path.join(
            os.path.dirname(__file__), '..', '..'))

    # Read the configuration file for the shared repository to get the pull path
    repo = hg.repository(
        ui.ui(), os.path.join(os.path.dirname(__file__), '..'))
    sharedpath = repo.ui.config('paths', 'default', None)
    if sharedpath is None:
        raise Exception('no default path in the shared directory!')

    unstable = sharedpath.endswith('-unstable')
    path = os.path.dirname(sharedpath)
    print 'using %s as remote repository path' % path

    for module in reduce(lambda x, y: x + y.split(','), argv, []):
        if module.endswith('-unstable'):
            module = module[:-len('-unstable')]

        if not os.path.exists(os.path.join(destdir, module)):
            # Attempt to clone the repository to the destination
            if module == "GUIRipper-Plugin-JFC" or module == "GUIRipper-Core" or module == "GUITARModel-Plugin-JFC" or module == "GUITARModel-Core" or module == "GUIReplayer-Plugin-JFC" or module == "GUIReplayer-Core":
				call("git clone git://github.com/cmsc435sikuli/" + module + ".git " + destdir + "/" +  module, shell=True)
            else:
                url = '%s/%s%s' % (path, module, '-unstable' if unstable else '')
                print 'checking out %s to %s' % (url, destdir)
                commands.clone(ui.ui(), url, os.path.join(destdir, module))
        else:
            # Repository already exists, skip
            print '%s already exists (skipping)' % module
开发者ID:cmsc435sikuli,项目名称:shared,代码行数:31,代码来源:checkout.py


示例3: get_yaml_from_mercurial

def get_yaml_from_mercurial(vcs_address, vcs_subdir):
    from mercurial import ui, commands
    from urllib2 import HTTPError
    import hglib

    vtemp = mkdtemp(prefix='multipkg-vcs-')
    try:
        commands.clone(ui.ui(), str(vcs_address), dest=vtemp)
        client = hglib.open(vtemp)
        # get index.yaml
        path_to_yaml = path_join(vtemp, vcs_subdir, 'index.yaml')
        yaml = yaml_load(file(path_to_yaml).read())
        recent_changes = []
        for entry in client.log('tip:tip^^'):
            num, rev, none, branch, author, msg, date = entry
            date = date.strftime('%Y-%m-%d %H:%M:%S')
            recent_changes.append("commit %s | Author: %s | Date:  %s \n%s\n" %
                                  (rev, author, date, msg))
        yaml['.'] = dict(recent_changes="\n".join(recent_changes))
        return yaml
    except HTTPError:
        raise RemotePackageNotFoundError(vcs_address)
    except IOError as e:
        if e.errno == errno.ENOENT and e.filename.find('.yaml') > -1:
            raise IndexNotFoundError('index.yaml not found in your repository')
        raise
    except:
        raise
    finally:
        if isdir(vtemp):
            rmtree(vtemp)
开发者ID:jianingy,项目名称:multipkgadmin,代码行数:31,代码来源:utils.py


示例4: test_branchmap_rebuildmeta

    def test_branchmap_rebuildmeta(self):
        '''test rebuildmeta on a branchmapped clone'''
        repo_path = self.load_svndump('branchmap.svndump')
        branchmap = open(self.branchmap, 'w')
        branchmap.write("badname = dit\n")
        branchmap.write("feature = dah\n")
        branchmap.close()
        ui = self.ui()
        ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
        commands.clone(ui, test_util.fileurl(repo_path),
                       self.wc_path, branchmap=self.branchmap)
        originfo = self.repo.svnmeta().branches

        # clone & rebuild
        ui = self.ui()
        src, dest = test_util.hgclone(ui, self.wc_path, self.wc_path + '_clone',
                                      update=False)
        src = test_util.getlocalpeer(src)
        dest = test_util.getlocalpeer(dest)
        svncommands.rebuildmeta(ui, dest,
                                args=[test_util.fileurl(repo_path)])

        # just check the keys; assume the contents are unaffected by the branch
        # map and thus properly tested by other tests
        self.assertEquals(sorted(src.svnmeta().branches),
                          sorted(dest.svnmeta().branches))
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:26,代码来源:test_fetch_mappings.py


示例5: nclone

def nclone(ui, source, dest=None, **opts):
    '''make a copy of an existing repository and all nested repositories

    Create a copy of an existing repository in a new directory.

    Look at the help of clone command for more informations.'''
    origsource = ui.expandpath(source)
    remotesource, remotebranch = hg.parseurl(origsource, opts.get('branch'))
    if hasattr(hg, 'peer'):
        remoterepo = hg.peer(ui, opts, remotesource)
        localrepo = remoterepo.local()
        if localrepo:
            remoterepo = localrepo
    else:
        remoterepo = hg.repository(hg.remoteui(ui, opts), remotesource)
    if dest is None:
        dest = hg.defaultdest(source)
        ui.status(_("destination directory: %s\n") % dest)
    for npath in remoterepo.nested:
        if npath == '.':
            npath = ''
        u = util.url(source)
        if u.scheme:
            nsource = '%s/%s' % (source, npath)
        else:
            nsource = os.path.join(source, npath)
        ndest = os.path.join(dest, npath)
        ui.status('[%s]\n' % os.path.normpath(
            os.path.join(os.path.basename(dest),
                ndest[len(dest) + 1:])))
        commands.clone(ui, nsource, dest=ndest, **opts)
        ui.status('\n')
开发者ID:tygerlord,项目名称:hgnested,代码行数:32,代码来源:__init__.py


示例6: test_updatemetahook

    def test_updatemetahook(self):
        repo, repo_path = self._loadupdate('single_rev.svndump')
        state = repo.parents()
        self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
        commands.pull(self.repo.ui, self.repo)

        # Clone to a new repository and add a hook
        new_wc_path = "%s-2" % self.wc_path
        commands.clone(self.repo.ui, self.wc_path, new_wc_path)
        newrepo = hg.repository(test_util.testui(), new_wc_path)
        newrepo.ui.setconfig('hooks', 'changegroup.meta',
                'python:hgsubversion.hooks.updatemeta.hook')

        # Commit a rev that should trigger svn meta update
        self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed Again'})
        commands.pull(self.repo.ui, self.repo)

        self.called = False
        import hgsubversion.svncommands
        oldupdatemeta = hgsubversion.svncommands.updatemeta
        def _updatemeta(ui, repo, args=[]):
            self.called = True
        hgsubversion.svncommands.updatemeta = _updatemeta

        # Pull and make sure our updatemeta function gets called
        commands.pull(newrepo.ui, newrepo)
        hgsubversion.svncommands.updatemeta = oldupdatemeta
        self.assertTrue(self.called)
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:28,代码来源:test_hooks.py


示例7: pull

    def pull(self, source=None, target=None):
        from mercurial import commands, hg, ui, error
        log.debug("Clone or update HG repository.")

        source = source or self.source
        target = target or self.target

        # Folders need to be manually created
        if not os.path.exists(target):
            os.makedirs(target)

        # Doesn't work with unicode type
        url = str(source)
        path = str(target)

        try:
            repo = hg.repository(ui.ui(), path)
            commands.pull(ui.ui(), repo, source=url)
            commands.update(ui.ui(), repo)
            log.debug("Mercurial: repository at " + url + " updated.")
        except error.RepoError, e:
            log.debug("Mercurial: " + str(e))
            try:
                commands.clone(ui.ui(), url, path)
                log.debug("Mercurial: repository at " + url + " cloned.")
            except Exception, e:
                log.debug("Mercurial: " + str(e))
                raise PullFromRepositoryException(unicode(e))
开发者ID:diasks2,项目名称:pontoon,代码行数:28,代码来源:vcs.py


示例8: clone_repo

def clone_repo(ui, clone_url, target_dir, fullName):
    """
    Clones the specified repository. Returns True if successful. If
    the clone fails, prints an error message and returns False,
    without aborting the entire process.
    """
    # If the filesystem does not use Unicode (from Python’s perspective),
    # convert target_dir to plain ASCII.
    if not sys.getfilesystemencoding().upper().startswith('UTF'):
        target_dir = target_dir.encode('ascii', 'xmlcharrefreplace')
    # Mercurial API throws an exception if target_dir is passed (below)
    # as unicode object, so it's required to be converted to string.
    else:
        target_dir = str(target_dir)
    
    # If directory already exists...
    if os.path.isdir(target_dir):
        # ... and is not empty...
        if os.listdir(target_dir):
            # ... just skip it, without aborting the entire process.
            ui.warn(encode_stderr(('Warning: directory %s already exists ' +
                'and is not empty, it will be skipped.\n') % target_dir))
            return False
    # Otherwise create required catalogs tree.
    else:
        os.makedirs(target_dir)
    
    ui.status(encode_stdout('\nCloning "%s" repository\n' % fullName))
    commands.clone(ui, clone_url, dest=target_dir)
    return True
开发者ID:pombredanne,项目名称:kiln-clone,代码行数:30,代码来源:kilnclone.py


示例9: internal_push_over_svnserve

    def internal_push_over_svnserve(self, subdir='', commit=True):
        test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump')
        open(os.path.join(self.repo_path, 'conf', 'svnserve.conf'),
             'w').write('[general]\nanon-access=write\n[sasl]\n')
        self.port = random.randint(socket.IPPORT_USERRESERVED, 65535)
        self.host = 'localhost'
        args = ['svnserve', '--daemon', '--foreground',
                '--listen-port=%d' % self.port,
                '--listen-host=%s' % self.host,
                '--root=%s' % self.repo_path]

        svnserve = subprocess.Popen(args, stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT)
        self.svnserve_pid = svnserve.pid
        try:
            time.sleep(2)
            import shutil
            shutil.rmtree(self.wc_path)
            commands.clone(self.ui(),
                           'svn://%s:%d/%s' % (self.host, self.port, subdir),
                           self.wc_path, noupdate=True)

            repo = self.repo
            old_tip = repo['tip'].node()
            expected_parent = repo['default'].node()
            def file_callback(repo, memctx, path):
                if path == 'adding_file':
                    return context.memfilectx(path=path,
                                              data='foo',
                                              islink=False,
                                              isexec=False,
                                              copied=False)
                raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
            ctx = context.memctx(repo,
                                 parents=(repo['default'].node(), node.nullid),
                                 text='automated test',
                                 files=['adding_file'],
                                 filectxfn=file_callback,
                                 user='an_author',
                                 date='2008-10-07 20:59:48 -0500',
                                 extra={'branch': 'default',})
            new_hash = repo.commitctx(ctx)
            if not commit:
                return # some tests use this test as an extended setup.
            hg.update(repo, repo['tip'].node())
            oldauthor = repo['tip'].user()
            commands.push(repo.ui, repo)
            tip = self.repo['tip']
            self.assertNotEqual(oldauthor, tip.user())
            self.assertNotEqual(tip.node(), old_tip)
            self.assertEqual(tip.parents()[0].node(), expected_parent)
            self.assertEqual(tip['adding_file'].data(), 'foo')
            self.assertEqual(tip.branch(), 'default')
            # unintended behaviour:
            self.assertNotEqual('an_author', tip.user())
            self.assertEqual('(no author)', tip.user().rsplit('@', 1)[0])
        finally:
            # TODO: use svnserve.kill() in Python >2.5
            test_util.kill_process(svnserve)
开发者ID:bulwinkel,项目名称:dot-files,代码行数:59,代码来源:test_push_command.py


示例10: upload

 def upload( self, trans, **kwd ):
     message = escape( kwd.get( 'message', '' ) )
     status = kwd.get( 'status', 'done' )
     commit_message = escape( kwd.get( 'commit_message', 'Uploaded'  ) )
     category_ids = util.listify( kwd.get( 'category_id', '' ) )
     categories = suc.get_categories( trans.app )
     repository_id = kwd.get( 'repository_id', '' )
     repository = suc.get_repository_in_tool_shed( trans.app, repository_id )
     repo_dir = repository.repo_path( trans.app )
     repo = hg_util.get_repo_for_repository( trans.app, repository=None, repo_path=repo_dir, create=False )
     uncompress_file = util.string_as_bool( kwd.get( 'uncompress_file', 'true' ) )
     remove_repo_files_not_in_tar = util.string_as_bool( kwd.get( 'remove_repo_files_not_in_tar', 'true' ) )
     uploaded_file = None
     upload_point = commit_util.get_upload_point( repository, **kwd )
     tip = repository.tip( trans.app )
     file_data = kwd.get( 'file_data', '' )
     url = kwd.get( 'url', '' )
     # Part of the upload process is sending email notification to those that have registered to
     # receive them.  One scenario occurs when the first change set is produced for the repository.
     # See the suc.handle_email_alerts() method for the definition of the scenarios.
     new_repo_alert = repository.is_new( trans.app )
     uploaded_directory = None
     if kwd.get( 'upload_button', False ):
         if file_data == '' and url == '':
             message = 'No files were entered on the upload form.'
             status = 'error'
             uploaded_file = None
         elif url and url.startswith( 'hg' ):
             # Use mercurial clone to fetch repository, contents will then be copied over.
             uploaded_directory = tempfile.mkdtemp()
             repo_url = 'http%s' % url[ len( 'hg' ): ]
             repo_url = repo_url.encode( 'ascii', 'replace' )
             try:
                 commands.clone( hg_util.get_configured_ui(), repo_url, uploaded_directory )
             except Exception, e:
                 message = 'Error uploading via mercurial clone: %s' % basic_util.to_html_string( str( e ) )
                 status = 'error'
                 basic_util.remove_dir( uploaded_directory )
                 uploaded_directory = None
         elif url:
             valid_url = True
             try:
                 stream = urllib.urlopen( url )
             except Exception, e:
                 valid_url = False
                 message = 'Error uploading file via http: %s' % str( e )
                 status = 'error'
                 uploaded_file = None
             if valid_url:
                 fd, uploaded_file_name = tempfile.mkstemp()
                 uploaded_file = open( uploaded_file_name, 'wb' )
                 while 1:
                     chunk = stream.read( util.CHUNK_SIZE )
                     if not chunk:
                         break
                     uploaded_file.write( chunk )
                 uploaded_file.flush()
                 uploaded_file_filename = url.split( '/' )[ -1 ]
                 isempty = os.path.getsize( os.path.abspath( uploaded_file_name ) ) == 0
开发者ID:BinglanLi,项目名称:galaxy,代码行数:59,代码来源:upload.py


示例11: load_fixture_and_fetch

def load_fixture_and_fetch(fixture_name, repo_path, wc_path, stupid=False, subdir='',
                           noupdate=True, layout='auto'):
    load_svndump_fixture(repo_path, fixture_name)
    if subdir:
        repo_path += '/' + subdir
    _ui = testui(stupid=stupid, layout=layout)
    commands.clone(_ui, fileurl(repo_path), wc_path, noupdate=noupdate)
    return hg.repository(testui(), wc_path)
开发者ID:chaptastic,项目名称:config_files,代码行数:8,代码来源:test_util.py


示例12: clone

 def clone(self):
     """If we don't have a copy of the open-ihm repository on disk
     clone one now.
     """
     try:
         self.chmod()
         commands.clone(self.ui, self.url, dest=REPO_DIR, insecure=True)
     except Exception:
         self.fail()
     return
开发者ID:r4vi,项目名称:open-ihm,代码行数:10,代码来源:frmupdateopenihm.py


示例13: test_diff_base_against_clone

    def test_diff_base_against_clone(self):
        """Test that the right error is raised on trying to do a diff across
        a different divergant clone"""
        ui = mock_ui()
        orig = os.path.join(settings.REPOSITORY_BASE, "orig")
        clone = os.path.join(settings.REPOSITORY_BASE, "clone")
        hgcommands.init(ui, orig)
        hgorig = repository(ui, orig)
        (
            open(hgorig.pathto("file.dtd"), "w").write(
                """
          <!ENTITY old "content we will delete">
          <!ENTITY mod "this has stuff to keep and delete">
        """
            )
        )
        hgcommands.addremove(ui, hgorig)
        hgcommands.commit(ui, hgorig, user="Jane Doe <[email protected]", message="initial commit")
        assert len(hgorig) == 1  # 1 commit

        # set up a second repo called 'clone'
        hgcommands.clone(ui, orig, clone)
        hgclone = repository(ui, clone)

        # new commit on base
        (
            open(hgorig.pathto("file.dtd"), "w").write(
                """
         <!ENTITY mod "this has stuff to keep and add">
         <!ENTITY new "this has stuff that is new">
         """
            )
        )
        hgcommands.commit(ui, hgorig, user="Jane Doe <[email protected]", message="second commit on base")
        assert len(hgorig) == 2  # 2 commits
        rev_from = hgorig[1].hex()

        # different commit on clone
        (
            open(hgclone.pathto("file.dtd"), "w").write(
                """
         <!ENTITY mod "this has stuff to keep and change">
         <!ENTITY new_in_clone "this has stuff that is different from base">
         """
            )
        )
        hgcommands.commit(ui, hgclone, user="John Doe <[email protected]", message="a different commit on clone")
        rev_to = hgclone[1].hex()

        Repository.objects.create(name="orig", url="http://localhost:8001/orig/")
        Repository.objects.create(name="clone", url="http://localhost:8001/clone/")

        url = reverse("pushes.views.diff")
        # right now, we can't diff between repos, this might change!
        self.assertRaises(RepoError, self.client.get, url, {"repo": "clone", "from": rev_from[:12], "to": rev_to[:12]})
开发者ID:gerv,项目名称:elmo,代码行数:55,代码来源:tests.py


示例14: test_file_map

 def test_file_map(self, stupid=False):
     test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
     filemap = open(self.filemap, 'w')
     filemap.write("include alpha\n")
     filemap.close()
     ui = self.ui(stupid)
     ui.setconfig('hgsubversion', 'filemap', self.filemap)
     commands.clone(ui, test_util.fileurl(self.repo_path),
                    self.wc_path, filemap=self.filemap)
     self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
     self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
开发者ID:chaptastic,项目名称:config_files,代码行数:11,代码来源:test_fetch_mappings.py


示例15: test_file_map_exclude

 def test_file_map_exclude(self, stupid=False):
     test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
     filemap = open(self.filemap, 'w')
     filemap.write("exclude alpha\n")
     filemap.close()
     ui = self.ui(stupid)
     ui.setconfig('hgsubversion', 'filemap', self.filemap)
     commands.clone(ui, test_util.fileurl(self.repo_path),
                    self.wc_path, filemap=self.filemap)
     self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
     self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
开发者ID:chaptastic,项目名称:config_files,代码行数:11,代码来源:test_fetch_mappings.py


示例16: test_branchmap_empty_commit

 def test_branchmap_empty_commit(self):
     '''test mapping an empty commit on a renamed branch'''
     repo_path = self.load_svndump('propset-branch.svndump')
     branchmap = open(self.branchmap, 'w')
     branchmap.write("the-branch = bob\n")
     branchmap.close()
     ui = self.ui()
     ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
     commands.clone(ui, test_util.fileurl(repo_path),
                    self.wc_path, branchmap=self.branchmap)
     branches = set(self.repo[i].branch() for i in self.repo)
     self.assertEquals(sorted(branches), ['bob', 'default'])
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:12,代码来源:test_fetch_mappings.py


示例17: bb_create

def bb_create(ui, reponame, **opts):
    data = {
        'name': reponame,
        'description': opts.get('description'),
        'language': opts.get('language'),
        'website': opts.get('website'),
    }
    _bb_apicall(ui, 'repositories', data)
    # if this completes without exception, assume the request was successful,
    # and clone the new repo
    ui.write('repository created, cloning...\n')
    commands.clone(ui, 'bb://' + reponame)
开发者ID:bulwinkel,项目名称:dot-files,代码行数:12,代码来源:hgbb.py


示例18: test_branchmap_tagging

 def test_branchmap_tagging(self):
     '''test tagging a renamed branch, which used to raise an exception'''
     repo_path = self.load_svndump('commit-to-tag.svndump')
     branchmap = open(self.branchmap, 'w')
     branchmap.write("magic = art\n")
     branchmap.close()
     ui = self.ui()
     ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
     commands.clone(ui, test_util.fileurl(repo_path),
                    self.wc_path, branchmap=self.branchmap)
     branches = set(self.repo[i].branch() for i in self.repo)
     self.assertEquals(sorted(branches), ['art', 'closeme'])
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:12,代码来源:test_fetch_mappings.py


示例19: test_empty_log_message

    def test_empty_log_message(self):
        repo, repo_path = self.load_and_fetch('empty-log-message.svndump')

        self.assertEqual(repo['tip'].description(), '')

        test_util.rmtree(self.wc_path)

        ui = self.ui()
        ui.setconfig('hgsubversion', 'defaultmessage', 'blyf')
        commands.clone(ui, test_util.fileurl(repo_path), self.wc_path)

        self.assertEqual(self.repo['tip'].description(), 'blyf')
开发者ID:fuzzball81,项目名称:dotfiles,代码行数:12,代码来源:test_fetch_mappings.py


示例20: handlePushes

def handlePushes(repo_id, submits, do_update=True):
    if not submits:
        return
    repo = Repository.objects.get(id=repo_id)
    revisions = reduce(lambda r,l: r+l,
                       [p.changesets for p in submits],
       [])
    ui = _ui()
    repopath = os.path.join(settings.REPOSITORY_BASE,
                            repo.name)
    configpath = os.path.join(repopath, '.hg', 'hgrc')
    if not os.path.isfile(configpath):
        if not os.path.isdir(os.path.dirname(repopath)):
            os.makedirs(os.path.dirname(repopath))
        clone(ui, str(repo.url), str(repopath),
              pull=False, uncompressed=False, rev=[],
              noupdate=False)
        cfg = open(configpath, 'a')
        cfg.write('default-push = ssh%s\n' % str(repo.url)[4:])
        cfg.close()
        ui.readconfig(configpath)
        hgrepo = repository(ui, repopath)
    else:
        ui.readconfig(configpath)
        hgrepo = repository(ui, repopath)
        cs = submits[-1].changesets[-1]
        try:
            hgrepo.changectx(cs)
        except RepoError:
            pull(ui, hgrepo, source = str(repo.url),
                 force=False, update=False,
                 rev=[])
            if do_update:
                update(ui, hgrepo)
    for data in submits:
        changesets = []
        for revision in data.changesets:
            try:
                cs = getChangeset(repo, hgrepo, revision)
                transaction.commit()
                changesets.append(cs)
            except Exception, e:
                transaction.rollback()
                raise
                print repo.name, e
        p = Push.objects.create(repository = repo,
                                push_id = data.id, user = data.user,
                                push_date =
                                datetime.utcfromtimestamp(data.date))
        p.changesets = changesets
        p.save()
        transaction.commit()
开发者ID:lauraxt,项目名称:elmo,代码行数:52,代码来源:utils.py



注:本文中的mercurial.commands.clone函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python commands.commit函数代码示例发布时间:2022-05-27
下一篇:
Python commands.add函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap