Package com.aragost.javahg.merge

Examples of com.aragost.javahg.merge.GraftContext


        repo.lock();
        HgInputStream stream = launchStream(changeset.getNode());
        try {
            if (stream.match("grafting revision ".getBytes())) {
                int rev = stream.revisionUpTo('\n');
                GraftContext ctx = new GraftContext(this, rev);
                if (!stream.isEof()) {
                    ctx.processStream(stream, true);
                }
                stream.consumeAll();
                boolean flagOrKeepDeleteConflicts = !ctx.getFlagConflicts().isEmpty()
                        || !ctx.getKeepDeleteConflicts().isEmpty();
                if (getReturnCode() == -1 && this.hasConflicts || flagOrKeepDeleteConflicts) {
                    if (flagOrKeepDeleteConflicts && ctx.getMergeConflicts().isEmpty()) {
                        // graft has actually made a new changeset,
                        // but
                        // there is actually flag conflict or
                        // keep/delete
                        // conflict. So rollback the changeset.
                        Changeset rollbackChangeset = repo.tip();
                        if (!changeset.getNode().equals(rollbackChangeset.getExtra().getString("source"))) {
                            throw new IllegalStateException("Current tip is not grafted from expected changeset");
                        }
                        RollbackCommand.on(repo).execute();
                        ctx.setRollbackChangeset(rollbackChangeset);
                    }
                    return ctx;
                } else {
                    return null;
                }
View Full Code Here


        repo.lock();
        HgInputStream stream = launchStream(changeset.getNode());
        try {
            if (stream.match("grafting revision ".getBytes())) {
                int rev = stream.revisionUpTo('\n');
                GraftContext ctx = new GraftContext(this, rev);
                if (!stream.isEof()) {
                    ctx.processStream(stream, true);
                }
                stream.consumeAll();
                boolean flagOrKeepDeleteConflicts = !ctx.getFlagConflicts().isEmpty()
                        || !ctx.getKeepDeleteConflicts().isEmpty();
                if (getReturnCode() != 0 && this.hasConflicts || flagOrKeepDeleteConflicts) {
                    if (flagOrKeepDeleteConflicts && ctx.getMergeConflicts().isEmpty()) {
                        // graft has actually made a new changeset,
                        // but
                        // there is actually flag conflict or
                        // keep/delete
                        // conflict. So rollback the changeset.
                        Changeset rollbackChangeset = repo.tip();
                        if (!changeset.getNode().equals(rollbackChangeset.getExtra().getString("source"))) {
                            throw new IllegalStateException("Current tip is not grafted from expected changeset");
                        }
                        RollbackCommand.on(repo).execute();
                        ctx.setRollbackChangeset(rollbackChangeset);
                    }
                    return ctx;
                } else {
                    return null;
                }
View Full Code Here

        Changeset changed = commit();
        update(base);
        RemoveCommand.on(repo).execute("file");
        Changeset removed = commit();

        GraftContext ctx = GraftCommand.on(repo).execute(changed);
        Assert.assertNotNull(ctx);
        Assert.assertTrue(ctx.getFlagConflicts().isEmpty());
        Assert.assertTrue(ctx.getMergeConflicts().isEmpty());
        KeepDeleteConflict kdc = Utils.single(ctx.getKeepDeleteConflicts());
        Assert.assertNotNull(kdc);
        Assert.assertSame(removed, repo.tip());
        Assert.assertEquals("file", kdc.getFilename());
        Assert.assertSame(changed, ctx.getSource());
        kdc.delete();
        // TODO commiting results in an error, see issue 3261
        // Changeset cs = ctx.commit();
        // Assert.assertNotNull(cs);
    }
View Full Code Here

        Changeset changed1 = commit();
        update(base);
        writeFile("file", "Y");
        commit();

        GraftContext ctx = GraftCommand.on(repo).execute(changed1);
        Assert.assertNotNull(ctx);
        Assert.assertTrue(ctx.getFlagConflicts().isEmpty());
        Assert.assertTrue(ctx.getKeepDeleteConflicts().isEmpty());
        MergeConflict mergeConflict = Utils.single(ctx.getMergeConflicts());
        Assert.assertNotNull(mergeConflict);
        // Mercurial 2.2 will skip empty commits, so we must resolve
        // with new content.
        writeFile("file", "XY");
        mergeConflict.markResolved();
        Changeset cs = ctx.commit();
        Assert.assertNotNull(cs);
        Assert.assertEquals(changed1.getNode(), cs.getExtra().getString("source"));
    }
View Full Code Here

TOP

Related Classes of com.aragost.javahg.merge.GraftContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.