Beispiel #1
0
 def d():
     # acceptremote is True because we don't want prompts in the middle of
     # our benchmark
     merge.calculateupdates(repo,
                            wctx,
                            rctx, [ancestor],
                            False,
                            False,
                            acceptremote=True,
                            followcopies=True)
Beispiel #2
0
    def _calculatemergedfiles(self, source, p1ctx, p2ctx):
        """Calculates the files from p2 that we need to pull in when merging p1
        and p2, given that the merge is coming from the given source.

        This prevents us from losing files that only exist in the target p2 and
        that don't come from the source repo (like if you're merging multiple
        repositories together).
        """
        anc = [p1ctx.ancestor(p2ctx)]
        # Calculate what files are coming from p2
        # TODO: mresult.commitinfo might be able to get that info
        mresult = mergemod.calculateupdates(
            self.repo,
            p1ctx,
            p2ctx,
            anc,
            branchmerge=True,
            force=True,
            acceptremote=False,
            followcopies=False,
        )

        for file, (action, info, msg) in mresult.filemap():
            if source.targetfilebelongstosource(file):
                # If the file belongs to the source repo, ignore the p2
                # since it will be covered by the existing fileset.
                continue

            # If the file requires actual merging, abort. We don't have enough
            # context to resolve merges correctly.
            if action in [b'm', b'dm', b'cd', b'dc']:
                raise error.Abort(
                    _(b"unable to convert merge commit "
                      b"since target parents do not merge cleanly (file "
                      b"%s, parents %s and %s)") % (file, p1ctx, p2ctx))
            elif action == b'k':
                # 'keep' means nothing changed from p1
                continue
            else:
                # Any other change means we want to take the p2 version
                yield file
Beispiel #3
0
    def _calculatemergedfiles(self, source, p1ctx, p2ctx):
        """Calculates the files from p2 that we need to pull in when merging p1
        and p2, given that the merge is coming from the given source.

        This prevents us from losing files that only exist in the target p2 and
        that don't come from the source repo (like if you're merging multiple
        repositories together).
        """
        anc = [p1ctx.ancestor(p2ctx)]
        # Calculate what files are coming from p2
        actions, diverge, rename = mergemod.calculateupdates(
            self.repo, p1ctx, p2ctx, anc,
            True,  # branchmerge
            True,  # force
            False, # partial
            False, # acceptremote
            False, # followcopies
        )

        for file, (action, info, msg) in actions.iteritems():
            if source.targetfilebelongstosource(file):
                # If the file belongs to the source repo, ignore the p2
                # since it will be covered by the existing fileset.
                continue

            # If the file requires actual merging, abort. We don't have enough
            # context to resolve merges correctly.
            if action in ['m', 'dm', 'cd', 'dc']:
                raise util.Abort(_("unable to convert merge commit "
                    "since target parents do not merge cleanly (file "
                    "%s, parents %s and %s)") % (file, p1ctx,
                                                 p2ctx))
            elif action == 'k':
                # 'keep' means nothing changed from p1
                continue
            else:
                # Any other change means we want to take the p2 version
                yield file
Beispiel #4
0
 def d():
     # acceptremote is True because we don't want prompts in the middle of
     # our benchmark
     merge.calculateupdates(repo, wctx, rctx, ancestor, False, False, False,
                            acceptremote=True)