Commit Graph

185 Commits

Author SHA1 Message Date
Michael Haggerty
1388618a60 Extract a method commit_tree().
Its implementation needs to be changed, so centralized how it is called.
2013-05-17 10:29:32 +02:00
Michael Haggerty
2d420ce8f0 Fix Python 2.6.x compatibility.
The subprocess module in Python 2.6 has a CalledProcessError class,
but its constructor doesn't take a third (output) argument.  So don't
only pass the constructor two arguments.
2013-05-17 09:30:14 +02:00
Michael Haggerty
2c9656309f Complete web links.
(If a web log is called a "blog", is a web link called a "blink"?)
2013-05-16 16:39:47 +02:00
Michael Haggerty
7854ecd038 Merge branch 'vertex-consistency'
Handle the automatic merges at the vertex of a block more carefully,
by merging them two ways and verifying that the two resulting trees
are identical.
2013-05-14 10:18:29 +02:00
Michael Haggerty
8d283e9658 Handle vertex merges more carefully.
When autofilling the vertex of a block, it is possible to do the merge
three ways:

1. Using the commits directly above and to the left as parents

2. Using the commits at [i1,0] and [i1-1,i2] as parents (i.e., as a
   continuation of the bottom edge)

3. Using the commits at [i1,i2-1] and [0,i2] as parents (i.e., as a
   continuation of the right edge)

We want the final history to be *as if* the parents were as in (1).

Formerly we were doing (1) and simply using the result.  This is
incorrect because the neighboring commits do not have correct
histories.  Therefore, the merge base for this merge is [0,0], and the
merge can have unnecessary conflicts.

Change to trying both (2) and (3).  If both of those commits succeed
*and* if they give identical trees, then create a synthetic commit
with the parents as in (1) and use that; otherwise, fail.
2013-05-14 10:07:01 +02:00
Michael Haggerty
c41fa18056 Make message for UnexpectedMergeFailure sound less scary.
And give the user hope that progress is still possible.

Suggested by: Thomas Nilsson <knirch@unixangst.com>
2013-05-14 09:30:26 +02:00
Michael Haggerty
43c96036be Add a function get_tree(). 2013-05-14 09:30:26 +02:00
Michael Haggerty
52067e92fb Merge branch 'test-dirs'
Manage the directories used by the tests better.
2013-05-14 07:47:12 +02:00
Michael Haggerty
3258cfdfb4 Rename "test-conflictless" to "test-unconflicted".
I have typed it wrong several times now so it seems to want its
new name.
2013-05-14 07:46:53 +02:00
Michael Haggerty
914aa3c32f Fix MergeFrontier.remove_failure().
MergeFrontier.remove_failure() was not doing the right thing.  If
there is a conflict like this:

    *******
    *......
    *.....X
    *......

then it should attempt to split the conflicting block into two blocks
(one of which might be empty) like this:

    *****||
    -----++
    *....|X
    -----+.

but instead it is doing this:

    *****|*
    *----+.
    *.....X
    *......

which is nonsense.  This could lead to an infinite loop (GitHub issue
2013-05-14 07:40:14 +02:00
Michael Haggerty
e1f377ea4a Remove unused local variables.
Usually pyflakes detects problems like this, but it missed this one...

Problem was pointed out by Thomas Nilsson <knirch@unixangst.com>
2013-05-14 07:08:03 +02:00
Peter Jönsson
593dea1422 Use python2 from environment
Some environments might have a old and/or broken version of python2
installed in /usr/bin but still wish to use git-imerge. The non-broken
version of python might be loaded separately from the base operating
system image via for example environment modules [1].

So use the currently active python2 from the environment instead of
hard coding the path to /usr/bin/python2.

[1] http://modules.sourceforge.net/
2013-05-13 10:55:39 +02:00
Michael Haggerty
dfbe2d446d Merge branch 'git-merge-talk'.
Add a talk that I presented at GitMerge 2013.
2013-05-11 18:01:59 +02:00
Michael Haggerty
e7e4b9acee Add the talk that I presented at GitMerge 2013. 2013-05-11 18:01:12 +02:00
Michael Haggerty
34ad88aebf Add the files used automatically by "rst2s5 --theme=small-white".
These files are in the public domain, except for iepngfix.htc, which
is under LGPL 2.1+ (see notice in file).

This command adds the pristine versions of the files, so that the
small changes that I made in the files in the next commit will be
documented.
2013-05-11 17:57:08 +02:00
Michael Haggerty
2bceac55ef Ignore all *.html files, but only in top directory. 2013-05-11 17:29:55 +02:00
Michael Haggerty
1f023c49cc Add a Makefile.
Type "make html" to convert the reStructuredText files to HTML.
2013-05-11 16:34:55 +02:00
Michael Haggerty
c706be10de Add a script to remove test detritus from the temporary test repository. 2013-05-11 16:29:18 +02:00
Michael Haggerty
ba8bd57bae Fix test scripts' use of directories.
The test scripts used to assume that they were being run from a
strange place.  Instead, teach them to derive the main project
directory "BASE" from $0 and

* always place the temporary directory at $BASE/t/tmp

* always run git-imerge from $BASE/git-imerge

* be more careful before deleting an old test directory.
2013-05-11 16:24:09 +02:00
Jeff King
f9c06e2876 t: don't use well-known git aliases
Not everybody has them, which can cause the test script to
abort.
2013-05-10 11:17:03 +02:00
Michael Haggerty
fa647c2b3a Add a TODO file. 2013-05-08 14:09:02 +02:00
Michael Haggerty
87e63c556f Improve the README file. 2013-05-08 14:08:30 +02:00
Michael Haggerty
3ef66b97e1 Improve the prompt for merge conflicts. 2013-05-08 14:06:52 +02:00
Michael Haggerty
4ae814411a Add method MergeRecord.is_manual(). 2013-05-07 17:03:24 +02:00
Michael Haggerty
176627375b Merge branch 'remember-blockers'
Keep track of which commits block frontier blocker blocks.  (Hmmm,
maybe the word "block" is being overused...)

This makes it possible to preserve a persistent record of which of the
blocks on the current frontier have no hope of progressing without
user interaction, and allow us to avoid some checks at every program
start.

I also think that with some extra code we could use an *unblocked*
blocker when bisecting and outlining and thereby avoid the need to
outline unblocked blocks as two blocks in many cases; i.e., instead of
filling such a block like this:

    *******
    *@.....
    *?????.
    *?????.
    *......

we could fill it like this:

    *******
    *@????.
    *?????.
    *?????.
    *......

and thereby avoid a lot of bookkeeping commits.
2013-05-07 16:15:14 +02:00
Michael Haggerty
b388b1a05c Update the blockers when a [1,1] merge fails or when the user records a manual merge.
This means that we have to call save() even if
MergeFrontier.auto_expand() raises a FrontierBlockedError.
2013-05-07 16:12:35 +02:00
Michael Haggerty
ce0ef7a97f In MergeFrontier.compute_by_bisection(), exit early if commit [1,1] is blocked. 2013-05-07 16:10:54 +02:00
Michael Haggerty
7fc14255fa Do not allow the MergeFrontier to pass through a blocked merge. 2013-05-07 16:10:42 +02:00
Michael Haggerty
57763acf26 Make incorporate_user_merge() return the blocked block that would be affected.
Raise NoManualMergeError if there was no manual merge ready to go.

Raise NotABlockingCommitError if the manual merge was not blocking the
frontier.
2013-05-07 16:09:58 +02:00
Michael Haggerty
99f732a4ac Teach "diagram" to show blockers. 2013-05-07 16:09:58 +02:00
Michael Haggerty
8c7b9dd2a6 Change how user merges are incorporated.
Rename MergeFrontier.add_success() to get_affected_blocker_block() and
change it to return the block that was freed up by the new merge.  If
there is no such merge, raise an exception.
2013-05-07 16:09:58 +02:00
Michael Haggerty
6ac36f1ccf Allow "blocker" commits to be recorded as part of MergeState. 2013-05-07 16:09:58 +02:00
Michael Haggerty
9fd67a3670 Tighten up logic in MergeFrontier.compute_by_bisection().
This removes some redundant automerge attempts.

Also add lots of comments and expand the method docstring.
2013-05-07 16:09:58 +02:00
Michael Haggerty
3922ea6563 Output json without indentation but with a trailing newline. 2013-05-07 15:52:01 +02:00
Michael Haggerty
b1eee46e2d Change tests to output both kinds of diagram. 2013-05-07 15:52:01 +02:00
Michael Haggerty
06f10442e4 Make Block.set_value() private and remove Block.__setitem__().
Callers shouldn't be setting records like this.  They should get the
MergeRecord using __getitem__() and then modify the MergeRecord in
place.
2013-05-06 14:21:25 +02:00
Michael Haggerty
5effd876e7 Merge branch 'fill-diagram'
Generate diagram output in two stages:

* Write one string for each commit to a 2D array
* Write the array to output

Then give access to the former functionality via new fill_diagram()
methods.
2013-05-06 10:35:44 +02:00
Michael Haggerty
9e416d4b6c Extract a method MergeFrontier.fill_diagram(). 2013-05-06 10:34:54 +02:00
Michael Haggerty
159c1b9d88 Extract a method Block.fill_diagram(). 2013-05-06 10:34:53 +02:00
Michael Haggerty
c26bac9269 Merge branch 'pyflakes'
Fix up several coding errors discovered by pyflakes.
2013-05-06 10:34:10 +02:00
Michael Haggerty
b09f973906 Remove unused local variable. 2013-05-06 10:32:58 +02:00
Michael Haggerty
b1a5e7cd1d Fix reference to member variable "goal". 2013-05-06 10:32:30 +02:00
Michael Haggerty
5363bcad9c Invoke static method using class from static method. 2013-05-06 10:31:39 +02:00
Michael Haggerty
2fde7055a4 Remove unused imports. 2013-05-06 10:30:14 +02:00
Michael Haggerty
ee33bab0ac Add links to new blog posts. 2013-05-06 09:10:26 +02:00
Michael Haggerty
c89d8bab3d Use notation %d-%d to refer to merges. 2013-05-05 16:43:21 +02:00
Michael Haggerty
ee8dab4004 Teach "remove" how to abort a merge conflict. 2013-05-05 16:43:21 +02:00
Michael Haggerty
c9cee43666 Make MergeState.get_scratch_refname() static. 2013-05-05 16:43:21 +02:00
Michael Haggerty
261bed8ab1 Fix how require_clean_work_tree() deals with an unmerged file. 2013-05-05 16:43:21 +02:00
Michael Haggerty
eb29d1ece8 Emit informational messages for autofills, too. 2013-05-05 16:43:21 +02:00