Пример #1
0
def graft(repo, ctx, pctx, labels):
    """Do a graft-like merge.

    This is a merge where the merge ancestor is chosen such that one
    or more changesets are grafted onto the current changeset. In
    addition to the merge, this fixes up the dirstate to include only
    a single parent and tries to duplicate any renames/copies
    appropriately.

    ctx - changeset to rebase
    pctx - merge base, usually ctx.p1()
    labels - merge labels eg ['local', 'graft']

    """

    stats = update(repo,
                   ctx.node(),
                   True,
                   True,
                   False,
                   pctx.node(),
                   labels=labels)
    # drop the second merge parent
    repo.dirstate.beginparentchange()
    repo.setparents(repo['.'].node(), nullid)
    repo.dirstate.write()
    # fix up dirstate for copies and renames
    copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
    repo.dirstate.endparentchange()
    return stats
Пример #2
0
def graft(repo, ctx, pctx, labels):
    """Do a graft-like merge.

    This is a merge where the merge ancestor is chosen such that one
    or more changesets are grafted onto the current changeset. In
    addition to the merge, this fixes up the dirstate to include only
    a single parent and tries to duplicate any renames/copies
    appropriately.

    ctx - changeset to rebase
    pctx - merge base, usually ctx.p1()
    labels - merge labels eg ['local', 'graft']

    """

    stats = update(repo, ctx.node(), True, True, False, pctx.node(),
                   labels=labels)
    # drop the second merge parent
    repo.dirstate.beginparentchange()
    repo.setparents(repo['.'].node(), nullid)
    repo.dirstate.write()
    # fix up dirstate for copies and renames
    copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
    repo.dirstate.endparentchange()
    return stats
Пример #3
0
def graft(repo, ctx, pctx, labels):
    """Do a graft-like merge.

    This is a merge where the merge ancestor is chosen such that one
    or more changesets are grafted onto the current changeset. In
    addition to the merge, this fixes up the dirstate to include only
    a single parent and tries to duplicate any renames/copies
    appropriately.

    ctx - changeset to rebase
    pctx - merge base, usually ctx.p1()
    labels - merge labels eg ['local', 'graft']

    """
    # If we're grafting a descendant onto an ancestor, be sure to pass
    # mergeancestor=True to update. This does two things: 1) allows the merge if
    # the destination is the same as the parent of the ctx (so we can use graft
    # to copy commits), and 2) informs update that the incoming changes are
    # newer than the destination so it doesn't prompt about "remote changed foo
    # which local deleted".
    mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node())

    stats = update(repo, ctx.node(), True, True, False, pctx.node(),
                   mergeancestor=mergeancestor, labels=labels)

    # drop the second merge parent
    repo.dirstate.beginparentchange()
    repo.setparents(repo['.'].node(), nullid)
    repo.dirstate.write()
    # fix up dirstate for copies and renames
    copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
    repo.dirstate.endparentchange()
    return stats
Пример #4
0
def graft(repo, ctx, pctx, labels):
    """Do a graft-like merge.

    This is a merge where the merge ancestor is chosen such that one
    or more changesets are grafted onto the current changeset. In
    addition to the merge, this fixes up the dirstate to include only
    a single parent and tries to duplicate any renames/copies
    appropriately.

    ctx - changeset to rebase
    pctx - merge base, usually ctx.p1()
    labels - merge labels eg ['local', 'graft']

    """
    # If we're grafting a descendant onto an ancestor, be sure to pass
    # mergeancestor=True to update. This does two things: 1) allows the merge if
    # the destination is the same as the parent of the ctx (so we can use graft
    # to copy commits), and 2) informs update that the incoming changes are
    # newer than the destination so it doesn't prompt about "remote changed foo
    # which local deleted".
    mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node())

    stats = update(repo,
                   ctx.node(),
                   True,
                   True,
                   False,
                   pctx.node(),
                   mergeancestor=mergeancestor,
                   labels=labels)

    # drop the second merge parent
    repo.dirstate.beginparentchange()
    repo.setparents(repo['.'].node(), nullid)
    repo.dirstate.write()
    # fix up dirstate for copies and renames
    copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
    repo.dirstate.endparentchange()
    return stats