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

Python hg.parseurl函数代码示例

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

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



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

示例1: goutgoing

def goutgoing(ui, repo, dest=None, **opts):
    """show the outgoing changesets alongside an ASCII revision graph

    Print the outgoing changesets alongside a revision graph drawn with
    ASCII characters.

    Nodes printed as an @ character are parents of the working
    directory.
    """

    check_unsupported_flags(opts)
    dest = ui.expandpath(dest or 'default-push', dest or 'default')
    dest, branches = hg.parseurl(dest, opts.get('branch'))
    revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
    other = hg.repository(cmdutil.remoteui(ui, opts), dest)
    if revs:
        revs = [repo.lookup(rev) for rev in revs]
    ui.status(_('comparing with %s\n') % url.hidepassword(dest))
    o = repo.findoutgoing(other, force=opts.get('force'))
    if not o:
        ui.status(_("no changes found\n"))
        return

    o = repo.changelog.nodesbetween(o, revs)[0]
    revdag = graphrevs(repo, o, opts)
    displayer = show_changeset(ui, repo, opts, buffered=True)
    showparents = [ctx.node() for ctx in repo[None].parents()]
    generate(ui, revdag, displayer, showparents, asciiedges)
开发者ID:Frostman,项目名称:intellij-community,代码行数:28,代码来源:graphlog.py


示例2: get_repo

def get_repo(alias, url):
    """Returns a hg.repository object initialized for usage.
    """

    try:
        from mercurial import hg, ui
    except ImportError:
        die("Mercurial python libraries not installed")

    ui = ui.ui()
    source, revs = hg.parseurl(ui.expandpath(url), ['tip'])
    repo = hg.repository(ui, source)

    prefix = 'refs/hg/%s/' % alias
    debug("prefix: '%s'", prefix)

    repo.hg = hg
    repo.gitdir = ""
    repo.alias = alias
    repo.prefix = prefix
    repo.revs = revs

    repo.git_hg = GitHg(warn)
    exporter = GitExporter(repo.git_hg, repo, 'hg.marks', 'git.marks', prefix)
    non_local = NonLocalHg(repo, alias)

    repo.exporter = exporter
    repo.non_local = non_local

    return repo
开发者ID:SRabbelier,项目名称:git,代码行数:30,代码来源:git-remote-hg.py


示例3: pull

def pull(oldpull, ui, repo, source="default", **opts):
    # translate bookmark args to rev args for actual pull
    if opts.get('bookmark'):
        # this is an unpleasant hack as pull will do this internally
        source, branches = hg.parseurl(ui.expandpath(source),
                                       opts.get('branch'))
        other = hg.repository(hg.remoteui(repo, opts), source)
        rb = other.listkeys('bookmarks')

        for b in opts['bookmark']:
            if b not in rb:
                raise util.Abort(_('remote bookmark %s not found!') % b)
            opts.setdefault('rev', []).append(b)

    result = oldpull(ui, repo, source, **opts)

    # update specified bookmarks
    if opts.get('bookmark'):
        for b in opts['bookmark']:
            # explicit pull overrides local bookmark if any
            ui.status(_("importing bookmark %s\n") % b)
            repo._bookmarks[b] = repo[rb[b]].node()
        write(repo)

    return result
开发者ID:ThissDJ,项目名称:designhub,代码行数:25,代码来源:bookmarks.py


示例4: outgoing

	def outgoing(self):
		limit = cmdutil.loglimit(opts)
		dest, revs, checkout = hg.parseurl(
			ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
		if revs:
			revs = [repo.lookup(rev) for rev in revs]

		other = hg.repository(cmdutil.remoteui(repo, opts), dest)
		ui.status(_('comparing with %s\n') % url.hidepassword(dest))
		o = repo.findoutgoing(other, force=opts.get('force'))
		if not o:
			ui.status(_("no changes found\n"))
			return 1
		o = repo.changelog.nodesbetween(o, revs)[0]
		if opts.get('newest_first'):
			o.reverse()
		displayer = cmdutil.show_changeset(ui, repo, opts)
		count = 0
		for n in o:
			if count >= limit:
				break
			parents = [p for p in repo.changelog.parents(n) if p != nullid]
			if opts.get('no_merges') and len(parents) == 2:
				continue
			count += 1
			displayer.show(repo[n])
开发者ID:ararog,项目名称:iShareCode,代码行数:26,代码来源:SynchronizeController.py


示例5: goutgoing

def goutgoing(ui, repo, dest=None, **opts):
    """show the outgoing changesets alongside an ASCII revision graph

    Print the outgoing changesets alongside a revision graph drawn with
    ASCII characters.

    Nodes printed as an @ character are parents of the working
    directory.
    """

    check_unsupported_flags(opts)
    dest, revs, checkout = hg.parseurl(
        ui.expandpath(dest or 'default-push', dest or 'default'),
        opts.get('rev'))
    if revs:
        revs = [repo.lookup(rev) for rev in revs]
    other = hg.repository(cmdutil.remoteui(ui, opts), dest)
    ui.status(_('comparing with %s\n') % url.hidepassword(dest))
    o = repo.findoutgoing(other, force=opts.get('force'))
    if not o:
        ui.status(_("no changes found\n"))
        return

    o = repo.changelog.nodesbetween(o, revs)[0]
    revdag = graphrevs(repo, o, opts)
    fmtdag = asciiformat(ui, repo, revdag, opts)
    ascii(ui, asciiedges(fmtdag))
开发者ID:wangbiaouestc,项目名称:WindowsMingWMC,代码行数:27,代码来源:graphlog.py


示例6: validate_hg_url

 def validate_hg_url(self, url):
     error = _("Invalid Hg URL: '%s'") % url
     source, branches = hg.parseurl(url)
     try:
         hg.repository(ui.ui(), source)
     except RepoError:
         raise forms.ValidationError(error)
开发者ID:brutasse-archive,项目名称:ci,代码行数:7,代码来源:forms.py


示例7: _findbundle

def _findbundle(repo, rev):
    """Returns the backup bundle that contains the given rev. If found, it
    returns the bundle peer and the full rev hash. If not found, it return None
    and the given rev value.
    """
    ui = repo.ui
    backuppath = repo.vfs.join("strip-backup")
    backups = filter(os.path.isfile, glob.glob(backuppath + "/*.hg"))
    backups.sort(key=lambda x: os.path.getmtime(x), reverse=True)
    for backup in backups:
        # Much of this is copied from the hg incoming logic
        source = os.path.relpath(backup, pycompat.getcwd())
        source = ui.expandpath(source)
        source, branches = hg.parseurl(source)
        other = hg.peer(repo, {}, source)

        quiet = ui.quiet
        try:
            ui.quiet = True
            ret = bundlerepo.getremotechanges(ui, repo, other, None, None, None)
            localother, chlist, cleanupfn = ret
            for node in chlist:
                if hex(node).startswith(rev):
                    return other, node
        except error.LookupError:
            continue
        finally:
            ui.quiet = quiet

    return None, rev
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:30,代码来源:reset.py


示例8: 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


示例9: incoming

def incoming(oldincoming, ui, repo, source="default", **opts):
    if opts.get('bookmarks'):
        source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
        other = hg.repository(hg.remoteui(repo, opts), source)
        ui.status(_('comparing with %s\n') % url.hidepassword(source))
        return diffbookmarks(ui, repo, other)
    else:
        return oldincoming(ui, repo, source, **opts)
开发者ID:ThissDJ,项目名称:designhub,代码行数:8,代码来源:bookmarks.py


示例10: incoming

	def incoming(self):
		limit = cmdutil.loglimit(opts)
		source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
		other = hg.repository(cmdutil.remoteui(repo, opts), source)
		ui.status(_('comparing with %s\n') % url.hidepassword(source))
		if revs:
			revs = [other.lookup(rev) for rev in revs]
		common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
                                                       force=opts["force"])
		if not incoming:
			try:
				os.unlink(opts["bundle"])
			except:
				pass
			ui.status(_("no changes found\n"))
			return 1

		cleanup = None
		try:
			fname = opts["bundle"]
			if fname or not other.local():
				# create a bundle (uncompressed if other repo is not local)

				if revs is None and other.capable('changegroupsubset'):
					revs = rheads

				if revs is None:
					cg = other.changegroup(incoming, "incoming")
				else:
					cg = other.changegroupsubset(incoming, revs, 'incoming')
				bundletype = other.local() and "HG10BZ" or "HG10UN"
				fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
				# keep written bundle?
				if opts["bundle"]:
					cleanup = None
				if not other.local():
					# use the created uncompressed bundlerepo
					other = bundlerepo.bundlerepository(ui, repo.root, fname)

			o = other.changelog.nodesbetween(incoming, revs)[0]
			if opts.get('newest_first'):
				o.reverse()
			displayer = cmdutil.show_changeset(ui, other, opts)
			count = 0
			for n in o:
				if count >= limit:
					break
				parents = [p for p in other.changelog.parents(n) if p != nullid]
				if opts.get('no_merges') and len(parents) == 2:
					continue
				count += 1
				displayer.show(other[n])
		finally:
			if hasattr(other, 'close'):
				other.close()
			if cleanup:
				os.unlink(cleanup)
开发者ID:ararog,项目名称:iShareCode,代码行数:57,代码来源:SynchronizeController.py


示例11: outgoing

def outgoing(oldoutgoing, ui, repo, dest=None, **opts):
    if opts.get('bookmarks'):
        dest = ui.expandpath(dest or 'default-push', dest or 'default')
        dest, branches = hg.parseurl(dest, opts.get('branch'))
        other = hg.repository(hg.remoteui(repo, opts), dest)
        ui.status(_('comparing with %s\n') % url.hidepassword(dest))
        return diffbookmarks(ui, other, repo)
    else:
        return oldoutgoing(ui, repo, dest, **opts)
开发者ID:ThissDJ,项目名称:designhub,代码行数:9,代码来源:bookmarks.py


示例12: find_pull_peer

def find_pull_peer(repo, opts, source):
    source, branches = hg.parseurl(repo.ui.expandpath(source), opts.get('branch'))
    try:
        return hg.peer(repo, opts, source)
    except error.RepoError:
        if source == "default":
            return
        else:
            raise
开发者ID:bhuztez,项目名称:hgtools,代码行数:9,代码来源:remotehq.py


示例13: gincoming

def gincoming(ui, repo, source="default", **opts):
    """show the incoming changesets alongside an ASCII revision graph

    Print the incoming changesets alongside a revision graph drawn with
    ASCII characters.

    Nodes printed as an @ character are parents of the working
    directory.
    """

    check_unsupported_flags(opts)
    source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
    other = hg.repository(cmdutil.remoteui(repo, opts), source)
    revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
    ui.status(_('comparing with %s\n') % url.hidepassword(source))
    if revs:
        revs = [other.lookup(rev) for rev in revs]
    incoming = repo.findincoming(other, heads=revs, force=opts["force"])
    if not incoming:
        try:
            os.unlink(opts["bundle"])
        except:
            pass
        ui.status(_("no changes found\n"))
        return

    cleanup = None
    try:

        fname = opts["bundle"]
        if fname or not other.local():
            # create a bundle (uncompressed if other repo is not local)
            if revs is None:
                cg = other.changegroup(incoming, "incoming")
            else:
                cg = other.changegroupsubset(incoming, revs, 'incoming')
            bundletype = other.local() and "HG10BZ" or "HG10UN"
            fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
            # keep written bundle?
            if opts["bundle"]:
                cleanup = None
            if not other.local():
                # use the created uncompressed bundlerepo
                other = bundlerepo.bundlerepository(ui, repo.root, fname)

        chlist = other.changelog.nodesbetween(incoming, revs)[0]
        revdag = graphrevs(other, chlist, opts)
        displayer = show_changeset(ui, other, opts, buffered=True)
        showparents = [ctx.node() for ctx in repo[None].parents()]
        generate(ui, revdag, displayer, showparents, asciiedges)

    finally:
        if hasattr(other, 'close'):
            other.close()
        if cleanup:
            os.unlink(cleanup)
开发者ID:Frostman,项目名称:intellij-community,代码行数:56,代码来源:graphlog.py


示例14: parseurl

def parseurl(url, heads=[]):
    url, heads = hg.parseurl(url, heads)
    if isinstance(heads, tuple) and len(heads) == 2:
        # hg 1.6 or later
        _junk, heads = heads
    if heads:
        checkout = heads[0]
    else:
        checkout = None
    return url, heads, checkout
开发者ID:Grahack,项目名称:git,代码行数:10,代码来源:util.py


示例15: find_push_peer

def find_push_peer(repo, opts, dest):
    dest = repo.ui.expandpath(dest or 'default-push', dest or 'default')
    dest, branches = hg.parseurl(dest, opts.get('branch'))

    try:
        return hg.peer(repo, opts, dest)
    except error.RepoError:
        if dest == "default-push":
            return
        else:
            raise
开发者ID:bhuztez,项目名称:hgtools,代码行数:11,代码来源:remotehq.py


示例16: _getsrcrepo

def _getsrcrepo(repo):
    """
    Returns the source repository object for a given shared repository.
    If repo is not a shared repository, return None.
    """
    if repo.sharedpath == repo.path:
        return None

    # the sharedpath always ends in the .hg; we want the path to the repo
    source = repo.vfs.split(repo.sharedpath)[0]
    srcurl, branches = parseurl(source)
    return repository(repo.ui, srcurl)
开发者ID:Distrotech,项目名称:mercurial,代码行数:12,代码来源:share.py


示例17: parseurl

def parseurl(url, heads=[]):
    parsed = hg.parseurl(url, heads)
    if len(parsed) == 3:
        # old hg, remove when we can be 1.5-only
        svn_url, heads, checkout = parsed
    else:
        svn_url, heads = parsed
        if heads:
            checkout = heads[0]
        else:
            checkout = None
    return svn_url, heads, checkout
开发者ID:chaptastic,项目名称:config_files,代码行数:12,代码来源:util.py


示例18: test

 def test(ui, repo, source, **opts):
     source, branches = hg.parseurl(ui.expandpath(source),
             opts.get('branch'))
     other = hg.repository(hg.remoteui(repo, opts), source)
     revs, checkout = hg.addbranchrevs(repo, other, branches,
             opts.get('rev'))
     if revs:
         try:
             revs = [other.lookup(rev) for rev in revs]
         except CapabilityError:
             err = _("Other repository doesn't support revision lookup, "
                     "so a rev cannot be specified.")
             raise util.Abort(err)
开发者ID:tygerlord,项目名称:hgnested,代码行数:13,代码来源:__init__.py


示例19: getoutgoing

 def getoutgoing(dest, revs):
     '''Return the revisions present locally but not in dest'''
     dest = ui.expandpath(dest or 'default-push', dest or 'default')
     dest, branches = hg.parseurl(dest)
     revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
     other = hg.peer(repo, opts, dest)
     ui.status(_('comparing with %s\n') % util.hidepassword(dest))
     common, _anyinc, _heads = discovery.findcommonincoming(repo, other)
     nodes = revs and map(repo.lookup, revs) or revs
     o = repo.changelog.findmissing(common, heads=nodes)
     if not o:
         ui.status(_("no changes found\n"))
         return []
     return [str(repo.changelog.rev(r)) for r in o]
开发者ID:agbiotec,项目名称:galaxy-tools-vcr,代码行数:14,代码来源:patchbomb.py


示例20: pull

	def pull(self):
		source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
		other = hg.repository(cmdutil.remoteui(repo, opts), source)
		ui.status(_('pulling from %s\n') % url.hidepassword(source))
		if revs:
			try:
				revs = [other.lookup(rev) for rev in revs]
			except error.CapabilityError:
				err = _("Other repository doesn't support revision lookup, "
						"so a rev cannot be specified.")
				raise util.Abort(err)

		modheads = repo.pull(other, heads=revs, force=opts.get('force'))
		return postincoming(ui, repo, modheads, opts.get('update'), checkout)
开发者ID:ararog,项目名称:iShareCode,代码行数:14,代码来源:SynchronizeController.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python hg.peer函数代码示例发布时间:2022-05-27
下一篇:
Python hg.clean函数代码示例发布时间: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