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

Python repair.strip函数代码示例

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

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



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

示例1: strip

def strip(ui, repo, changesets, *args , **opts):
    try:
        repair.strip(ui, repo, changesets, *args, **opts)
    except TypeError:
        # only 2.1.2 and later allow strip to take a list of nodes
        for changeset in changesets:
            repair.strip(ui, repo, changeset, *args, **opts)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:7,代码来源:util.py


示例2: unshelveabort

def unshelveabort(ui, repo, state, opts):
    """subcommand that abort an in-progress unshelve"""
    wlock = repo.wlock()
    lock = None
    try:
        checkparents(repo, state)
        lock = repo.lock()
        merge.mergestate(repo).reset()
        if opts['keep']:
            repo.setparents(repo.dirstate.parents()[0])
        else:
            revertfiles = readshelvedfiles(repo, state.name)
            wctx = repo.parents()[0]
            cmdutil.revert(ui, repo, wctx, [wctx.node(), nullid],
                           *revertfiles, **{'no_backup': True})
            # fix up the weird dirstate states the merge left behind
            mf = wctx.manifest()
            dirstate = repo.dirstate
            for f in revertfiles:
                if f in mf:
                    dirstate.normallookup(f)
                else:
                    dirstate.drop(f)
            dirstate._pl = (wctx.node(), nullid)
            dirstate._dirty = True
        repair.strip(ui, repo, state.stripnodes, backup='none', topic='shelve')
        shelvedstate.clear(repo)
        ui.warn(_("unshelve of '%s' aborted\n") % state.name)
    finally:
        lockmod.release(lock, wlock)
开发者ID:jordigh,项目名称:mercurial-crew,代码行数:30,代码来源:shelve.py


示例3: unshelveabort

def unshelveabort(ui, repo, state, opts):
    """subcommand that abort an in-progress unshelve"""
    wlock = repo.wlock()
    lock = None
    try:
        checkparents(repo, state)

        util.rename(repo.join('unshelverebasestate'),
                    repo.join('rebasestate'))
        try:
            rebase.rebase(ui, repo, **{
                'abort' : True
            })
        except Exception:
            util.rename(repo.join('rebasestate'),
                        repo.join('unshelverebasestate'))
            raise

        lock = repo.lock()

        mergefiles(ui, repo, state.wctx, state.pendingctx)

        repair.strip(ui, repo, state.stripnodes, backup='none', topic='shelve')
        shelvedstate.clear(repo)
        ui.warn(_("unshelve of '%s' aborted\n") % state.name)
    finally:
        lockmod.release(lock, wlock)
开发者ID:roopakparikh,项目名称:crane-node-hello,代码行数:27,代码来源:shelve.py


示例4: abort

def abort(repo, originalwd, target, state):
    'Restore the repository to its original state'
    dstates = [s for s in state.values() if s != nullrev]
    immutable = [d for d in dstates if not repo[d].mutable()]
    if immutable:
        raise util.Abort(_("can't abort rebase due to immutable changesets %s")
                         % ', '.join(str(repo[r]) for r in immutable),
                         hint=_('see hg help phases for details'))

    descendants = set()
    if dstates:
        descendants = set(repo.changelog.descendants(*dstates))
    if descendants - set(dstates):
        repo.ui.warn(_("warning: new changesets detected on target branch, "
                       "can't abort\n"))
        return -1
    else:
        # Strip from the first rebased revision
        merge.update(repo, repo[originalwd].rev(), False, True, False)
        rebased = filter(lambda x: x > -1 and x != target, state.values())
        if rebased:
            strippoint = min(rebased)
            # no backup of rebased cset versions needed
            repair.strip(repo.ui, repo, repo[strippoint].node())
        clearstatus(repo)
        repo.ui.warn(_('rebase aborted\n'))
        return 0
开发者ID:Pelonza,项目名称:Learn2Mine-Main,代码行数:27,代码来源:rebase.py


示例5: clearrebased

def clearrebased(ui, repo, state, skipped, collapsedas=None):
    """dispose of rebased revision at the end of the rebase

    If `collapsedas` is not None, the rebase was a collapse whose result if the
    `collapsedas` node."""
    if obsolete.isenabled(repo, obsolete.createmarkersopt):
        markers = []
        for rev, newrev in sorted(state.items()):
            if newrev >= 0:
                if rev in skipped:
                    succs = ()
                elif collapsedas is not None:
                    succs = (repo[collapsedas],)
                else:
                    succs = (repo[newrev],)
                markers.append((repo[rev], succs))
        if markers:
            obsolete.createmarkers(repo, markers)
    else:
        rebased = [rev for rev in state if state[rev] > nullmerge]
        if rebased:
            stripped = []
            for root in repo.set('roots(%ld)', rebased):
                if set(repo.changelog.descendants([root.rev()])) - set(state):
                    ui.warn(_("warning: new changesets detected "
                              "on source branch, not stripping\n"))
                else:
                    stripped.append(root.node())
            if stripped:
                # backup the old csets by default
                repair.strip(ui, repo, stripped, "all")
开发者ID:CSCI-362-02-2015,项目名称:RedTeam,代码行数:31,代码来源:rebase.py


示例6: abort

def abort(repo, originalwd, target, state):
    'Restore the repository to its original state'
    dstates = [s for s in state.values() if s > nullrev]
    immutable = [d for d in dstates if not repo[d].mutable()]
    cleanup = True
    if immutable:
        repo.ui.warn(_("warning: can't clean up immutable changesets %s\n")
                     % ', '.join(str(repo[r]) for r in immutable),
                     hint=_('see hg help phases for details'))
        cleanup = False

    descendants = set()
    if dstates:
        descendants = set(repo.changelog.descendants(dstates))
    if descendants - set(dstates):
        repo.ui.warn(_("warning: new changesets detected on target branch, "
                       "can't strip\n"))
        cleanup = False

    if cleanup:
        # Update away from the rebase if necessary
        if inrebase(repo, originalwd, state):
            merge.update(repo, repo[originalwd].rev(), False, True, False)

        # Strip from the first rebased revision
        rebased = filter(lambda x: x > -1 and x != target, state.values())
        if rebased:
            strippoints = [c.node()  for c in repo.set('roots(%ld)', rebased)]
            # no backup of rebased cset versions needed
            repair.strip(repo.ui, repo, strippoints)

    clearstatus(repo)
    repo.ui.warn(_('rebase aborted\n'))
    return 0
开发者ID:ZanderZhang,项目名称:Andriod-Learning,代码行数:34,代码来源:rebase.py


示例7: cleanupnode

def cleanupnode(ui, repo, name, nodes):
    """strip a group of nodes from the repository

    The set of node to strip may contains unknown nodes."""
    ui.debug('should strip %s nodes %s\n' %
             (name, ', '.join([node.short(n) for n in nodes])))
    lock = None
    try:
        lock = repo.lock()
        # do not let filtering get in the way of the cleanse
        # we should probably get rid of obsolescence marker created during the
        # histedit, but we currently do not have such information.
        repo = repo.unfiltered()
        # Find all nodes that need to be stripped
        # (we use %lr instead of %ln to silently ignore unknown items)
        nm = repo.changelog.nodemap
        nodes = sorted(n for n in nodes if n in nm)
        roots = [c.node() for c in repo.set("roots(%ln)", nodes)]
        for c in roots:
            # We should process node in reverse order to strip tip most first.
            # but this trigger a bug in changegroup hook.
            # This would reduce bundle overhead
            repair.strip(ui, repo, c)
    finally:
        release(lock)
开发者ID:CSCI-362-02-2015,项目名称:RedTeam,代码行数:25,代码来源:histedit.py


示例8: pushstrip

def pushstrip(repo, key, old, new):
    """pushkey for strip that allows remote stripping.

    We only allow users in a controlled users list to perform remote stripping.
    """
    if 'USER' not in os.environ:
        repo.ui.write(_('request not authenticated; cannot perform remote strip\n'))
        return 0

    allowed = repo.ui.configlist('reviewboard', 'remote_strip_users')
    if os.environ['USER'] not in allowed:
        repo.ui.write(_('user not in list of users allowed to remote strip\n'))
        return 0

    nodes = []
    for node in new.splitlines():
        ctx = repo[node]
        # Stripping changesets that are public carries too much risk that too
        # many children changesets will also get stripped. Disallow the
        # practice.
        if ctx.phase() == phases.public:
            repo.ui.write(_('cannot strip public changeset: %s\n') % ctx.hex())
            return 0

        nodes.append(ctx.node())

    # The strip extension does higher-level things like remove bookmarks
    # referencing stripped changesets. We shouldn't need this functionality, so
    # we use the core API.
    repair.strip(repo.ui, repo, nodes, backup=True, topic='remotestrip')
    return 1
开发者ID:armenzg,项目名称:version-control-tools,代码行数:31,代码来源:server.py


示例9: strip

def strip(ui, repo, revs, update=True, backup=True, force=None, bookmark=None):
    wlock = lock = None
    try:
        wlock = repo.wlock()
        lock = repo.lock()

        if update:
            checklocalchanges(repo, force=force)
            urev, p2 = repo.changelog.parents(revs[0])
            if (util.safehasattr(repo, 'mq') and
                p2 != nullid
                and p2 in [x.node for x in repo.mq.applied]):
                urev = p2
            hg.clean(repo, urev)
            repo.dirstate.write()

        repair.strip(ui, repo, revs, backup)

        marks = repo._bookmarks
        if bookmark:
            if bookmark == repo._bookmarkcurrent:
                bookmarks.unsetcurrent(repo)
            del marks[bookmark]
            marks.write()
            ui.write(_("bookmark '%s' deleted\n") % bookmark)
    finally:
        release(lock, wlock)
开发者ID:areshero,项目名称:ThirdWorldApp,代码行数:27,代码来源:strip.py


示例10: strip

def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None):
    wlock = lock = None
    try:
        wlock = repo.wlock()
        lock = repo.lock()

        if update:
            checklocalchanges(repo, force=force)
            urev, p2 = repo.changelog.parents(revs[0])
            if (util.safehasattr(repo, 'mq') and
                p2 != nullid
                and p2 in [x.node for x in repo.mq.applied]):
                urev = p2
            hg.clean(repo, urev)
            repo.dirstate.write(repo.currenttransaction())

        repair.strip(ui, repo, revs, backup)

        repomarks = repo._bookmarks
        if bookmarks:
            with repo.transaction('strip') as tr:
                if repo._activebookmark in bookmarks:
                    bookmarksmod.deactivate(repo)
                for bookmark in bookmarks:
                    del repomarks[bookmark]
                repomarks.recordchange(tr)
            for bookmark in sorted(bookmarks):
                ui.write(_("bookmark '%s' deleted\n") % bookmark)
    finally:
        release(lock, wlock)
开发者ID:motlin,项目名称:cyg,代码行数:30,代码来源:strip.py


示例11: _deleteunreachable

def _deleteunreachable(repo, ctx):
    """Deletes all ancestor and descendant commits of the given revision that
    aren't reachable from another bookmark.
    """
    keepheads = "bookmark() + ."
    try:
        extensions.find('remotenames')
        keepheads += " + remotenames()"
    except KeyError:
        pass
    hiderevs = repo.revs('::%s - ::(%r)', ctx.rev(), keepheads)
    if hiderevs:
        lock = None
        try:
            lock = repo.lock()
            if _isobsstoreenabled(repo):
                markers = []
                for rev in hiderevs:
                    markers.append((repo[rev], ()))
                obsolete.createmarkers(repo, markers)
                repo.ui.status(_("%d changesets pruned\n") % len(hiderevs))
            else:
                repair.strip(repo.ui, repo,
                             [repo.changelog.node(r) for r in hiderevs])
        finally:
            lockmod.release(lock)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:26,代码来源:reset.py


示例12: _stripoldcommits

 def _stripoldcommits(self):
     nodelist = self.replacemap.keys()
     # make sure we don't strip innocent children
     revs = self.repo.revs('%ln - (::(heads(%ln::)-%ln))', nodelist,
                           nodelist, nodelist)
     tonode = self.repo.changelog.node
     nodelist = [tonode(r) for r in revs]
     if nodelist:
         repair.strip(self.repo.ui, self.repo, nodelist)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:9,代码来源:__init__.py


示例13: removenodes

 def removenodes(self, ui, repo):
     """Cleanup temporary nodes from the repo"""
     if self.obsshelve:
         unfi = repo.unfiltered()
         relations = [(unfi[n or '.'], ()) for n in self.nodestoremove]
         obsolete.createmarkers(repo, relations)
     else:
         repair.strip(ui, repo, self.nodestoremove, backup=False,
                      topic='shelve')
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:9,代码来源:obsshelve.py


示例14: timetravel

def timetravel(ui, repo):
    "Change date of commit."

    ctx = repo[None].p1()
    while ctx.phase():
        ctx = ctx.p1()

    parent = ctx
    date = util.makedate()
    update_node, strip_nodes = copy_branch(repo, ctx, parent, date)
    if update_node:
        hg.update(repo, update_node)
    if strip_nodes:
        repair.strip(ui, repo, strip_nodes)
开发者ID:jdufresne,项目名称:timetravel,代码行数:14,代码来源:timetravel.py


示例15: abort

def abort(repo, originalwd, target, state):
    'Restore the repository to its original state'
    if set(repo.changelog.descendants(target)) - set(state.values()):
        repo.ui.warn(_("warning: new changesets detected on target branch, "
                                                    "not stripping\n"))
    else:
        # Strip from the first rebased revision
        merge.update(repo, repo[originalwd].rev(), False, True, False)
        rebased = filter(lambda x: x > -1, state.values())
        if rebased:
            strippoint = min(rebased)
            repair.strip(repo.ui, repo, repo[strippoint].node(), "strip")
        clearstatus(repo)
        repo.ui.status(_('rebase aborted\n'))
开发者ID:Frostman,项目名称:intellij-community,代码行数:14,代码来源:rebase.py


示例16: strip

    def strip(self, repo, revs, update=True, backup="all", force=None):
        wlock = lock = None
        try:
            wlock = repo.wlock()
            lock = repo.lock()

            if update:
                self.checklocalchanges(repo, force=force, refresh=False)
                urev = self.qparents(repo, revs[0])
                hg.clean(repo, urev)
                repo.dirstate.write()

            repair.strip(self.ui, repo, revs, backup)
        finally:
            release(lock, wlock)
开发者ID:peiyaoyao,项目名称:intellij-community,代码行数:15,代码来源:mq.py


示例17: strip

    def strip(self, repo, rev):
        wlock = lock = None
        try:
            wlock = repo.wlock()
            try:
                lock = repo.lock()

                self.removeundo(repo)
                repair.strip(self.ui, repo, rev, 'none')
                # strip may have unbundled a set of backed up revisions after
                # the actual strip
                self.removeundo(repo)
            finally:
                lock.release()
        finally:
            wlock.release()
开发者ID:axtl,项目名称:dotfiles,代码行数:16,代码来源:attic.py


示例18: abort

def abort(repo, originalwd, target, state, activebookmark=None):
    '''Restore the repository to its original state.  Additional args:

    activebookmark: the name of the bookmark that should be active after the
        restore'''

    try:
        # If the first commits in the rebased set get skipped during the rebase,
        # their values within the state mapping will be the target rev id. The
        # dstates list must must not contain the target rev (issue4896)
        dstates = [s for s in state.values() if s >= 0 and s != target]
        immutable = [d for d in dstates if not repo[d].mutable()]
        cleanup = True
        if immutable:
            repo.ui.warn(_("warning: can't clean up public changesets %s\n")
                        % ', '.join(str(repo[r]) for r in immutable),
                        hint=_('see "hg help phases" for details'))
            cleanup = False

        descendants = set()
        if dstates:
            descendants = set(repo.changelog.descendants(dstates))
        if descendants - set(dstates):
            repo.ui.warn(_("warning: new changesets detected on target branch, "
                        "can't strip\n"))
            cleanup = False

        if cleanup:
            # Update away from the rebase if necessary
            if needupdate(repo, state):
                merge.update(repo, originalwd, False, True, False)

            # Strip from the first rebased revision
            rebased = filter(lambda x: x >= 0 and x != target, state.values())
            if rebased:
                strippoints = [
                        c.node()  for c in repo.set('roots(%ld)', rebased)]
                # no backup of rebased cset versions needed
                repair.strip(repo.ui, repo, strippoints)

        if activebookmark and activebookmark in repo._bookmarks:
            bookmarks.activate(repo, activebookmark)

    finally:
        clearstatus(repo)
        repo.ui.warn(_('rebase aborted\n'))
    return 0
开发者ID:CSCI-362-02-2015,项目名称:RedTeam,代码行数:47,代码来源:rebase.py


示例19: strip

def strip(ui, repo, revs, update=True, backup="all", force=None):
    wlock = lock = None
    try:
        wlock = repo.wlock()
        lock = repo.lock()

        if update:
            checklocalchanges(repo, force=force)
            urev, p2 = repo.changelog.parents(revs[0])
            if p2 != nullid and p2 in [x.node for x in repo.mq.applied]:
                urev = p2
            hg.clean(repo, urev)
            repo.dirstate.write()

        repair.strip(ui, repo, revs, backup)
    finally:
        release(lock, wlock)
开发者ID:jordigh,项目名称:mercurial-crew,代码行数:17,代码来源:strip.py


示例20: unshelvecontinue

def unshelvecontinue(ui, repo, state, opts):
    """subcommand to continue an in-progress unshelve"""
    # We're finishing off a merge. First parent is our original
    # parent, second is the temporary "fake" commit we're unshelving.
    wlock = repo.wlock()
    lock = None
    try:
        checkparents(repo, state)
        ms = merge.mergestate(repo)
        if [f for f in ms if ms[f] == 'u']:
            raise error.Abort(
                _("unresolved conflicts, can't continue"),
                hint=_("see 'hg resolve', then 'hg unshelve --continue'"))

        lock = repo.lock()

        util.rename(repo.join('unshelverebasestate'),
                    repo.join('rebasestate'))
        try:
            rebase.rebase(ui, repo, **{
                'continue' : True
            })
        except Exception:
            util.rename(repo.join('rebasestate'),
                        repo.join('unshelverebasestate'))
            raise

        shelvectx = repo['tip']
        if not shelvectx in state.pendingctx.children():
            # rebase was a no-op, so it produced no child commit
            shelvectx = state.pendingctx
        else:
            # only strip the shelvectx if the rebase produced it
            state.stripnodes.append(shelvectx.node())

        mergefiles(ui, repo, state.wctx, shelvectx)

        repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve')
        shelvedstate.clear(repo)
        unshelvecleanup(ui, repo, state.name, opts)
        ui.status(_("unshelve of '%s' complete\n") % state.name)
    finally:
        lockmod.release(lock, wlock)
开发者ID:html-shell,项目名称:mozilla-build,代码行数:43,代码来源:shelve.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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