pax_global_header00006660000000000000000000000064137316543710014524gustar00rootroot0000000000000052 comment=c3fbcae3c1f1eb1c78ceacc4b1e5f95835464687 git-imerge-1.2.0/000077500000000000000000000000001373165437100135555ustar00rootroot00000000000000git-imerge-1.2.0/.gitignore000066400000000000000000000000631373165437100155440ustar00rootroot00000000000000*.egg-info/ *.pyc *.pyo .tox/ /*.html build/ dist/ git-imerge-1.2.0/COPYING000066400000000000000000000432541373165437100146200ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. git-imerge-1.2.0/MANIFEST.in000066400000000000000000000003631373165437100153150ustar00rootroot00000000000000include completions/git-imerge include COPYING include t/test-conflicted include t/test-drop include t/test-duplicated include t/test-flip-flop include t/test-lib.sh include t/test-really-conflicted include t/test-unconflicted include tox.ini git-imerge-1.2.0/Makefile000066400000000000000000000002461373165437100152170ustar00rootroot00000000000000all: module := doc/presentations/GitMerge-2013 html: $(module)/talk.html $(module)/talk.html: $(module)/talk.rst rst2s5 --theme=small-white --current-slide $< $@ git-imerge-1.2.0/README.md000066400000000000000000000346071373165437100150460ustar00rootroot00000000000000# git-imerge -- incremental merge and rebase for Git Perform a merge between two branches incrementally. If conflicts are encountered, figure out exactly which pairs of commits conflict, and present the user with one pairwise conflict at a time for resolution. `git-imerge` has two primary design goals: * Reduce the pain of resolving merge conflicts to its unavoidable minimum, by finding and presenting the smallest possible conflicts: those between the changes introduced by one commit from each branch. * Allow a merge to be saved, tested, interrupted, published, and collaborated on while it is in progress. I think that it is easiest to understand the concept of incremental merging visually, and therefore I recommend the video of my [git-imerge presentation from the GitMerge 2013 conference](http://www.youtube.com/watch?v=FMZ2_-Ny_zc) (20 min) as a good place to start. The full slides for that talk are available in this repository under `doc/presentations/GitMerge-2013`. At the same conference, I was interviewed about `git-imerge` by Thomas Ferris Nicolaisen for his [GitMinutes Podcast #12](http://episodes.gitminutes.com/2013/06/gitminutes-12-git-merge-2013-part-4.html). To learn how to use the `git-imerge` tool itself, I suggest the blog article [git-imerge: A Practical Introduction](http://softwareswirl.blogspot.com/2013/05/git-imerge-practical-introduction.html) and also typing `git-imerge --help` and `git-imerge SUBCOMMAND --help`. If you want more information, the theory and benefits of incremental merging are described in minute detail in a series of blog articles [[1](#REF1)], as are the benefits of retaining history when doing a rebase [[2](#REF2)]. Multiple incremental merges can be in progress at the same time. Each incremental merge has a name, and its progress is recorded in the Git repository as references under `refs/imerge/NAME`. The current state of an incremental merge can be visualized using the `diagram` command. An incremental merge can be interrupted and resumed arbitrarily, or even pushed to a server to allow somebody else to work on it. `git-imerge` comes with a Bash completion script, `completions/git-imerge`, which is installed automatically when installing `git-imerge`. ## Requirements `git-imerge` requires: * A Python interpreter; either * Python 3.x, version 3.3 or later. * Python 2.x, version 2.6 or later. If you are using Python 2.6.x, then you have to install the `argparse` module yourself, as it was only added to the standard library in Python 2.7. * A recent version of Git. Bash completion requires Git's completion being available. ## Installation `git-imerge` is available on PyPI_, so you can install it with `pip`: $ pip install git-imerge or using `setup.py` if you have downloaded the source package locally: $ python setup.py install ## Instructions To start a merge or rebase operation using `git-imerge`, you use commands that are similar to the corresponding `git` commands: | `git-imerge` command | `git` analogue | Effect | | -------------------- | -------------- | ------ | | `git-imerge merge BRANCH` | `git merge BRANCH` | Merge ``BRANCH`` into the current branch | | `git-imerge rebase BRANCH` | `git rebase BRANCH` | Rebase the current branch on top of ``BRANCH`` | | `git-imerge revert COMMIT` | `git revert COMMIT` | Add a new commit that undoes the effect of `COMMIT` | | `git-imerge revert COMMIT1..COMMIT2` | `git revert COMMIT1..COMMIT2` | Add new commits that undo the effects of `COMMIT1..COMMIT2` | | `git-imerge drop COMMIT` | `git rebase --onto COMMIT^ COMMIT` | Entirely delete commit `COMMIT` from the history of the current branch | | `git-imerge drop COMMIT1..COMMIT2` | `git rebase --onto COMMIT1 COMMIT2` | Entirely delete commits ``COMMIT1..COMMIT2`` from the history of the current branch | `git-imerge drop` is also analogous to running `git rebase --interactive`, then deleting the specified commit(s) from the history. Both the `drop` and the `revert` subcommands are included in git-imerge because the equivalent git operations can conflict, so they both can benefit from using the incremental merge approach.) A few more options are available if you start the incremental merge using `git imerge start`: $ git-imerge start --name=NAME --goal=GOAL [--first-parent] BRANCH where * `NAME` is the name for this merge (and also the default name of the branch to which the results will be saved). * `GOAL` describes how you want to simplify the results (see next section). After the incremental merge is started, you will be presented with any conflicts that have to be resolved. The basic procedure is similar to performing an incremental merge using `git`: while not done: <"git add" the files that you changed> git-imerge continue When you have resolved all of the conflicts, you finish the incremental merge by typing: git-imerge finish That should be enough to get you going. All of these subcommands have additional options; to learn about them type: git-imerge --help git-imerge SUBCMD --help ### Simplifying results When the incremental merge is finished, you can simplify its results in various ways before recording it in your project's permanent history by using either the `finish` or `simplify` command. The "goal" of the incremental merge can be one of the following: * `merge` — keep only a simple merge of the second branch into the first branch, discarding all intermediate merges. The end result is similar to what you would get from git checkout BRANCH1 git merge BRANCH2 * `rebase` — keep the versions of the commits from the second branch rebased onto the first branch. The end result is similar to what you would get from git checkout BRANCH2 git rebase BRANCH1 * `rebase-with-history` — like `rebase`, except that it retains the old versions of the rebased commits in the history. It is equivalent to merging the commits from `BRANCH2` into `BRANCH1`, one commit at a time. In other words, it transforms this: o---o---o---o BRANCH1 \ A---B---C---D BRANCH2 into this: o---o---o---o---A'--B'--C'--D' NEW_BRANCH \ / / / / --------A---B---C---D It is safe to rebase an already-published branch using this approach. See [[2](#REF2)] for more information. * `full` — don't simplify the incremental merge at all: do all of the intermediate merges and retain them all in the permanent history. In other words, it transforms this: o---o---1---2---3 BRANCH1 \ A---B---C---D BRANCH2 into this: o---o---1---2---3 \ \ \ \ A---A1--A2--A3 \ \ \ \ B---B1--B2--B3 \ \ \ \ C---C1--C2--C3 \ \ \ \ D---D1--D2--D3 NEW_BRANCH This approach retains the complete history and ancestry information, which gives the maximum flexibility for conducting future merges. On the other hand, it clutters up the permanent Git history considerably. * `border` — this experimental goal retains the rebase of `BRANCH2` onto `BRANCH1` and also the rebase of `BRANCH1` onto `BRANCH2`, plus a merge commit that includes both branches. In other words, it transforms this: o---o---1---2---3 BRANCH1 \ A---B---C---D BRANCH2 into this: o---o---1---2---3 \ \ A A2 \ \ B B2 \ \ C C2 \ \ D---D1--D2--D3 NEW_BRANCH This approach leaves more history than a simple merge or rebase, possibly making future merges easier. * `border-with-history` — this experimental goal retains the `rebase-with-history of` `BRANCH2` onto `BRANCH1` and also the rebase (without history) of `BRANCH1` onto `BRANCH2`, plus a merge commit that includes both branches. In other words, it transforms this: o---o---1---2---3 BRANCH1 \ A---B---C---D BRANCH2 into this: o---o---1---2---3 \ \ A-----------A3 \ \ B-----------B3 \ \ C-----------C3 \ \ D---D1--D2--D3 NEW_BRANCH This approach leaves more history and ancestry information than a simple merge or rebase, possibly making future merges easier. * `border-with-history2` — this experimental goal retains the `rebase-with-history` of `BRANCH1` onto `BRANCH2` and also the `rebase-with-history` of `BRANCH2` onto `BRANCH1`, plus a merge commit that includes both branches. In other words, it transforms this: o---o---1---2---3 BRANCH1 \ A---B---C---D BRANCH2 into this: o---o---1---2---3 \ \ \ \ A--- --- ---A3 \ \ \ \ B--- --- ---B3 \ \ \ \ C--- --- ---C3 \ \ \ \ D---D1--D2--D3 NEW_BRANCH This approach leaves more history and ancestry information than a simple merge or rebase, possibly making future merges easier. ## Technical notes ### Suspending/resuming When `git-imerge` needs to ask the user to do a merge manually, it creates a temporary branch `refs/heads/imerge/NAME` to hold the result. If you want to suspend an incremental merge to do something else before continuing, all you need to do is abort any pending merge using `git merge --abort` and switch to your other branch. When you are ready to resume the incremental merge, just type `git imerge continue`. If you need to completely abort an in-progress incremental merge, first remove the temporary branches `git-imerge` creates using `git-imerge remove`, then checkout the branch you were in before you started the incremental merge with `git checkout ORIGINAL_BRANCH`. ### Storage `git-imerge` records all of the intermediate state about an incremental merge in the Git object database as a bunch of references under `refs/imerge/NAME`, where `NAME` is the name of the imerge: * `refs/imerge/NAME/state` points to a blob that describes the current state of the imerge in JSON format; for example, * The tips of the two branches that are being merged * The current "blocker" merges (merges that the user will have to do by hand), if any * The simplification goal * The name of the branch to which the result will be written. * `refs/imerge/NAME/manual/I-J` and `refs/imerge/NAME/auto/I-J` refer to the manual and automatic merge commits, respectively, that have been done so far as part of the incremental merge. `I` and `J` are integers indicating the location `(I,J)` of the merge in the incremental merge diagram. ### Transferring an in-progress imerge between repositories It might sometimes be convenient to transfer an in-progress incremental merge from one Git repository to another. For example, you might want to make a backup of the current state, or continue an imerge at home that you started at work, or ask a colleague to do a particular pairwise merge for you. Since all of the imerge state is stored in the Git object database, this can be done by pushing/fetching the references named in the previous section. For example, $ git push --prune origin +refs/imerge/NAME/*:refs/imerge/NAME/* or $ git fetch --prune origin +refs/imerge/NAME/*:refs/imerge/NAME/* Please note that these commands _overwrite_ any state that already existed in the destination repository. There is currently no support for combining the work done by two people in parallel on an incremental merge, so for now you'll just have to take turns. ### Interaction with `git rerere` `git rerere` is a nice tool that records how you resolve merge conflicts, and if it sees the same conflict again it tries to automatically reuse the same resolution. Since `git-imerge` attempts so many similar test merges, it is easy to imagine `rerere` getting confused. Moreover, `git-imerge` relies on a merge resolving (or not resolving) consistently if it is carried out more than once. Having `rerere` store extra information behind the scenes could therefore confuse `git-imerge`. Indeed, in testing it appeared that during incremental merges, the interaction of `git-imerge` with `rerere` was sometimes causing merge conflicts to be resolved incorrectly. Therefore, `git-imerge` explicitly turns rerere off temporarily whenever it runs any `git` commands. ### Log messages for pairwise merge commits When `git imerge continue` or `git imerge record` finds a resolved merge in the working tree, it commits that merge then incorporates it into the incremental merge. Usually it just uses Git's autogenerated commit message for such commits. If you want to be prompted to edit such commit messages, you can either specify `--edit` on the command line or change the default in your configuration: $ git config --global imerge.editmergemessages true ## Testing `git-imerge` uses [`tox`](https://tox.readthedocs.io/) to run tests. To run the test suite with the system's default Python: $ tox To run with a specific Python version, such as 3.7, pass the `-e` argument to `tox`: $ tox -e py37 ## License `git-imerge` is released as open-source software under the GNU General Public License (GPL), version 2 or later. See file `COPYING` for more information. ## References [1] * http://softwareswirl.blogspot.com/2012/12/the-conflict-frontier-of-nightmare-merge.html * http://softwareswirl.blogspot.com/2012/12/mapping-merge-conflict-frontier.html * http://softwareswirl.blogspot.com/2012/12/real-world-conflict-diagrams.html * http://softwareswirl.blogspot.com/2013/05/git-incremental-merge.html * http://softwareswirl.blogspot.com/2013/05/one-merge-to-rule-them-all.html * http://softwareswirl.blogspot.com/2013/05/incremental-merge-vs-direct-merge-vs.html * http://softwareswirl.blogspot.com/2013/05/git-imerge-practical-introduction.html [2] * http://softwareswirl.blogspot.com/2009/04/truce-in-merge-vs-rebase-war.html * http://softwareswirl.blogspot.com/2009/08/upstream-rebase-just-works-if-history.html * http://softwareswirl.blogspot.com/2009/08/rebase-with-history-implementation.html git-imerge-1.2.0/TODO.md000066400000000000000000000132051373165437100146450ustar00rootroot00000000000000# Ideas for things to do ## Bugs * Find some bugs and fix them :-) * Check that the capstone merge in a block outline is merged correctly. * Since the ancestry of its two parents is incomplete, Git would probably try to do a recursive merge. See if we can somehow do better without filling in the whole diagram. * Compare the merges that would come from continuing each side of the outline, and verify that they are identical. ## Convenience features * Add a two-argument form of the `start` and `init` commands to specify both branches in one go. (Or maybe not, if we want to leave the way open to supporting octipus merges!) Maybe `--onto=X` like rebase? * Improve the handling of log messages. Incorporate log messages from manual merge conflicts into suggested log messages for the simplified commits. * Allow the user to specify which conflict they would like to resolve next, and set it up for them. * Allow the user to block certain merges, meaning that they should never be skipped over or merged automatically. * Add a `git imerge pause` that puts an imerge on hold and resets the working copy to a reasonable state. * Allow the user to specify a test that is run automatically after each automatic merge, (à la `git bisect run`). ## New merge goals and styles * Add a `--goal=sparse` option that retains all of the conflicted merges and enough intermediate history to connect them. * Add an option that allows the user to resolve conflicts in larger chunks; for example, add a rebase-with-history-type merge where each branch commit is merged directly to its final location on the last master commit. (Perhaps `--conflicts={pairwise|fewest}`.) * Permit switching between goal/conflict choices when they are meaningful while prohibiting nonsensical ones. ## Collaboration * Add `git imerge push REMOTE` to push the status of an in-progress merge to REMOTE. * Add `git imerge pull REMOTE` to pull the current state of an incremental merge from REMOTE. * Add some kind of `fetch`-like functionality that stores the result into a remote namespace. * The analogue of "non-fast-forward" for incremental merges is different than for other references. A `push`/`pull` should be prohibited if: * Any of the branches is updated in a non-fast-forward fashion. * Any commit `I1-I2` is updated (at all!) when there is an existing commit `I1'-I2'` with `I1' >= I1` and `I2' >= I2`. * As a safety precaution, the DAG of the retrieved merges should probably be checked for self-consistency (see `git imerge fsck` below). * Add smarter ways to reconcile two versions of an in-progress merge that are not fast-forwards of each other. Probably this should work with two arbitrary local merges (one of which is probably from a remote). ## Flexibility * Allow commits to be skipped over when merging if, for example, they are broken (analogous to `git bisect skip`). This should be allowed when an imerge is being initialized and also after an imerge is in progress. * Allow arbitrary manual merge commits to be recorded, and be smarter about how such commits are integrated. * Allow recorded merges to be retroactively rejected, adjusting subsequent merges accordingly. * In first version, just discard all commits that depended on it. * In later versions, salvage parts of the subsequent merges when possible. ### Relax `--first-parent` limitation * Allow recursive merges: if one of the `--first-parent` merges is itself a merge, maybe it can be "exploded" into individual commits and these commits merged with the second branch as part of the first merge or as a subsidiary merge. * Allow more complicated topologies in the two branches to be merged, and somehow form the appropriate Cartesian product of their commits with the correct ancestry. ## Tools * `git imerge info` -- show a detailed, human-readable summary of all intermediate commits related to this imerge. * `git imerge parse M-N` -- show SHA-1 of the specified merge if it has been done. Maybe also `git imerge parse NAME/M-N`. * `git imerge show M-N` -- show more, human-readable info about the specified imerge. * `git imerge list -v` -- add more information to the display; for example, the goals, status, etc. of each imerge. * `git imerge status` -- show the current imerge status (issue #22). If the user has been asked to do a merge, show the log messages for the two original commits again. ## Miscellaneous * Add a command `git imerge fsck` (for lack of a better name) that checks the consistency of the intermediate commits (especially their DAG). * Maybe expand diagram to 2x2 characters per merge, to make room for more information (e.g., block boundaries could go in the interstices). * Maybe fix PPM output. * Maybe keep a record of all merge attempts, successful and failed. * When running subprocesses, set a more specific value to environment variable `GIT_IMERGE` reflecting exactly what git-imerge is doing at the time (e.g., 'autofill', 'automerge', etc). See issue #17. * Add better tools and hints for getting out of a screwed-up merge attempt (see, e.g., issue #29). ## Testing * Add a tool that can create two branches with conflicts at arbitrary places. (This is pretty easy--if commit I1-I2 should conflict, then make commits I1 and I2 both create a file `conflict-i1-i2` with differing contents. * Test adjacent conflicts in various places. * Cook up some way to make conflicts that unexpectedly appear and disappear when merged as part of a block vs. pairwise. (Maybe this can be done using commits involving file renames followed by the addition of replacements.) Test such scenarios. ## GUI * Maybe add a web interface (implementing using Python's built-in webserver) would be easiest. git-imerge-1.2.0/completions/000077500000000000000000000000001373165437100161115ustar00rootroot00000000000000git-imerge-1.2.0/completions/git-imerge000066400000000000000000000124551373165437100200740ustar00rootroot00000000000000__git_imerge_branches () { git for-each-ref --format='%(refname)' refs/heads/ refs/remotes/ 2>/dev/null | sed -e 's!^refs/heads/!!' -e 's!^refs/remotes/!!' } __git_imerge_names () { git for-each-ref --format='%(refname)' refs/imerge/ 2>/dev/null | sed -e 's/^refs\/imerge\/\(.*\)\/.*/\1/' -e '/manual/d' -e '/auto/d' } __git_imerge_goals="\ merge rebase rebase-with-history full " __git_imerge_commands="\ start merge rebase drop revert continue finish diagram list init record autofill simplify remove reparent " __git_imerge_start_options="\ --help --manual --name --branch --goal --first-parent " __git_imerge_init_options=$__git_imerge_start_options __git_imerge_continue_options="\ --help --name --edit --no-edit " __git_imerge_finish_options="\ --help --name --goal --branch --force " __git_imerge_simplify_options=$__git_imerge_finish_options __git_imerge_merge_options="\ --help --name --goal --branch --manual " __git_imerge_drop_options="\ --help --name --branch --manual " __git_imerge_list_options="\ --help " __git_imerge_reparent_options=$__git_imerge_list_options __git_imerge_record_options="\ --help --name --edit --no-edit " __git_imerge_autofill_options="\ --help --name " __git_imerge_diagram_options="\ --help --name --commits --frontier --html --color --no-color " __git_imerge_remove_options=$__git_imerge_autofill_options __git_imerge_rebase_options=$__git_imerge_merge_options __git_imerge_revert_options=$__git_imerge_drop_options __git-imerge_start_completion() { case "$1_$cur" in --help_|--branch_|_--branch=|--name_|_--name=) return ;; --goal_*|*_--goal=*) __gitcomp "$__git_imerge_goals" "" "${cur##--goal=}" return ;; *-|*_-*?) __gitcomp "$__git_imerge_start_options" return ;; esac __gitcomp "$(__git_imerge_branches)" } __git-imerge_init_completion() { __git-imerge_start_completion $1 } __git-imerge_continue_completion() { case "$1_$cur" in --help_) return ;; --name_*|*_--name=*) __gitcomp "$(__git_imerge_names)" "" "${cur##--name=}" return ;; esac __gitcomp "$__git_imerge_continue_options" } __git-imerge_finish_completion() { case "$1_$cur" in --help_) return ;; --goal_*|*_--goal=*) __gitcomp "$__git_imerge_goals" "" "${cur##--goal=}" return ;; --branch_*|*_--branch=*) __gitcomp "$(__git_imerge_branches)" "" "${cur##--branch=}" return ;; --name_*|*_--name=*) __gitcomp "$(__git_imerge_names)" "" "${cur##--name=}" return ;; esac __gitcomp "$__git_imerge_finish_options" } __git-imerge_simplify_completion() { __git-imerge_finish_completion $1 } __git-imerge_merge_completion() { case "$1_$cur" in --help_|--branch_|_--branch=|--name_|_--name=) return ;; --goal_*|*_--goal=*) __gitcomp "$__git_imerge_goals" "" "${cur##--goal=}" return ;; *-|*_-*?) __gitcomp "$__git_imerge_merge_options" return ;; esac __gitcomp "$(__git_imerge_branches)" } __git-imerge_rebase_completion() { __git-imerge_merge_completion $1 } __git-imerge_drop_completion() { case "$1_$cur" in --help_|--branch_|_--branch=|--name_|_--name=) return ;; *-|*_-*?) __gitcomp "$__git_imerge_merge_options" return ;; esac __gitcomp "$(__git_imerge_branches)" } __git-imerge_revert_completion() { __git-imerge_drop_completion $1 } __git-imerge_list_completion() { case "$1" in --help) return ;; esac __gitcomp "$__git_imerge_list_options" } __git-imerge_reparent_completion() { __git-imerge_list_completion $1 } __git-imerge_record_completion() { case "$1_$cur" in --help_) return ;; --name_*|*_--name=*) __gitcomp "$(__git_imerge_names)" "" "${cur##--name=}" return ;; esac __gitcomp "$__git_imerge_record_options" } __git-imerge_autofill_completion() { case "$1_$cur" in --help_) return ;; --name_*|*_--name=*) __gitcomp "$(__git_imerge_names)" "" "${cur##--name=}" return ;; esac __gitcomp "$__git_imerge_autofill_options" } __git-imerge_remove_completion() { __git-imerge_autofill_completion $1 } __git-imerge_diagram_completion() { case "$1_$cur" in --help_|--html_|_--html=) return ;; --name_*|*_--name=*) __gitcomp "$(__git_imerge_names)" "" "${cur##--name=}" return ;; esac __gitcomp "$__git_imerge_diagram_options" } _git_imerge () { # Disable default filename completion. Note that "compopt" is only # available in Bash 4 and newer, so we check for existence before # trying to use it. type compopt >/dev/null 2>&1 && compopt +o default +o bashdefault local i command cur_opt # find which git-imerge subcommand is on the line # For example: # words=(git imerge start master) # command="start" # # Start looking at index 1 because the logic can be simpler when # it assumes that "imerge" will always be in the position before # the subcommand. for ((i=1; i <= ${cword}; i++)); do if [ -n "$command" ] && [ "${words[i]}" != "$cur" ]; then cur_opt="${words[i]}" fi if [ -z "$command" ] && \ [ "$i" -lt "${cword}" ] && \ [[ "${words[i-1]}" == *"imerge"* ]] then command="${words[i]}" fi done if test -z "$command"; then __gitcomp "$__git_imerge_commands" return fi if [ -z `type -t __git-imerge_"$command"_completion "$cur_opt"` ]; then return fi __git-imerge_"$command"_completion "$cur_opt" } git-imerge-1.2.0/doc/000077500000000000000000000000001373165437100143225ustar00rootroot00000000000000git-imerge-1.2.0/doc/presentations/000077500000000000000000000000001373165437100172205ustar00rootroot00000000000000git-imerge-1.2.0/doc/presentations/GitMerge-2013/000077500000000000000000000000001373165437100213065ustar00rootroot00000000000000git-imerge-1.2.0/doc/presentations/GitMerge-2013/.gitignore000066400000000000000000000000131373165437100232700ustar00rootroot00000000000000/talk.html git-imerge-1.2.0/doc/presentations/GitMerge-2013/README.txt000066400000000000000000000004111373165437100230000ustar00rootroot00000000000000I gave this talk on 2013-May-10 at the GitMerge conference in Berlin on "User Day". (I gave another, more technical talk on a whiteboard the day before at "Developer Day".) To convert it into HTML, run "make html" in the top-level directory. -- Michael Haggerty git-imerge-1.2.0/doc/presentations/GitMerge-2013/talk.rst000066400000000000000000001007501373165437100227760ustar00rootroot00000000000000.. include:: .. |bullet| unicode:: U+02022 .. footer:: Michael Haggerty |bullet| ``mhagger@alum.mit.edu`` |bullet| GitMerge conference 2013 ========== git-imerge ========== .. class:: center ``https://github.com/mhagger/git-imerge`` **Incremental merging for Git** | "git-merge on steroids" | or | "git-rebase for the masses" | Michael Haggerty | ``mhagger@alum.mit.edu`` | ``http://softwareswirl.blogspot.com/`` Overview ======== * Why you need it * What it does * How to use it Why incremental merge? ====================== .. class:: incremental .. container:: There are two standard alternatives for combining branches: * ``git merge`` * ``git rebase`` Both have serious problems. ``git merge`` pain ================== .. class:: incremental You need to resolve **one big conflict** that mixes up a lot of little changes on both sides of the merge. (Resolving big conflicts is **hard**!) ``git merge`` pain (cont'd) =========================== .. class:: incremental Merging is **all-or-nothing**. There is **no way to save** a partly-done merge, so * You can't record your progress. * You can't switch to another branch temporarily. * If you make a mistake, you can't go back. If you cannot resolve the **whole** conflict, there is nothing to do but start over. ``git merge`` pain (cont'd) =========================== .. class:: incremental * There is **no way to test** a partly-done merge. .. class:: incremental (The code won't even build until the conflict is completely resolved.) * It is **difficult to collaborate** on a merge with a colleague. ``git rebase`` pain =================== .. class:: incremental * You have to reconcile each of the branch commits with *all* of the changes on master. * Rebasing is **all-or-nothing**; it is awkward to interrupt a rebase while it is in progress. * Rebasing is **unfriendly to collaboration**; it is problematic to rebase work that has been published. ``git rebase`` pain (cont'd) ============================ .. class:: incremental * Rebasing **discards history** (namely the old version of the branch). * Rebasing often requires similar conflicts to be **resolved multiple times**. Incremental merge ================= ``git-imerge`` implements a new merging method, **incremental merge**, that reduces the pain of merging to its essential minimum. ``git-imerge`` ============== .. class:: incremental ``git-imerge`` presents conflicts pairwise, **one commit from each branch** * Small conflicts are *much* easier to resolve than large conflicts. * You can view commit messages and individual diffs to see what each commit was trying to do. ``git-imerge`` (cont'd) ======================= .. class:: incremental ``git-imerge`` **records all intermediate merges** ...with their correct ancestry, ...as commits in your repository. Because of this, an incremental merge... * ...can be **interrupted**. * ...can be **pushed to a server**. * ...can be **pulled by a colleague**, worked on, and pushed again. ``git-imerge`` (cont'd) ======================= .. class:: incremental ``git-imerge`` **never shows the same conflict twice**. * Once a conflict has been resolved, it is stored in the DAG to make future merges easier. ``git-imerge`` lets you **test every intermediate state**. * If there is a problem, you can use ``git bisect`` to find the exact pairwise merge that was faulty. * You can redo that merge and continue the incremental merge from there (retaining earlier pairwise merges). ``git-imerge`` (cont'd) ======================= .. class:: incremental ``git-imerge`` is **largely automated** and **surprisingly efficient**. ``git-imerge`` allows the final merge to be **simplified for the permanent record**, omitting the intermediate results. The basic idea ============== Suppose you want to merge "branch" into "master":: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master \ A - B - C - D - E - F - G ← branch .. class:: incremental First draw the diagram a bit differently... The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | A | B | C | D | E | F | G ↑ branch .. class:: incremental Now start filling it in, merging one pair at a time... The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | B | C | D | E | F | G ↑ branch .. class:: incremental "A1" is a merge commit between commit "1" on master and commit "A" on branch. It has two parents, like any merge commit. ``git-imerge`` stores commit A1 to your repository. The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | | B - B1 | C | D | E | F | G ↑ branch .. class:: incremental B1 is a merge between A1 and B. B1 only has to add the changes from commit B to state A1... ...or equivalently, the changes from 1 into state B. The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | | B - B1 | C | D | E | F | G ↑ branch .. class:: incremental Most of these pairwise merges will not conflict, and ``git-imerge`` will do them for you automatically ...until it finds a conflict... The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | | B - B1 | | C - C1 | D | E | F | G ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | | B - B1 | | C - C1 | | D - D1 | E | F | G ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | | B - B1 | | C - C1 | | D - D1 | | E - E1 | F | G ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | | B - B1 | | C - C1 | | D - D1 | | E - E1 | | F - F1 | G ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A - A1 | | B - B1 | | C - C1 | | D - D1 | | E - E1 | | F - F1 | | G - G1 ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | B - B1 | | C - C1 | | D - D1 | | E - E1 | | F - F1 | | G - G1 ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | C - C1 | | D - D1 | | E - E1 | | F - F1 | | G - G1 ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | D - D1 | | E - E1 | | F - F1 | | G - G1 ↑ branch .. class:: incremental Falling asleep? (No wonder; ``git-imerge`` is doing all the work.) It's time for a little quiz. The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | D - D1 | | E - E1 | | F - F1 | | G - G1 ↑ branch .. class:: incremental What is the meaning of C2? It adds the changes from commit C to state B2... ...equivalently, it adds the changes from commit 2 to state C1. The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | D - D1 | | E - E1 | | F - F1 | | G - G1 ↑ branch **Important take-home message**: .. class:: incremental * Each of these merges adds the changes from *one single* commit to a state that has already been committed. * Git knows a nearby common ancestor. The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | | D - D1 - D2 | | E - E1 | | F - F1 | | G - G1 ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | | D - D1 - D2 | | | E - E1 - E2 | | F - F1 | | G - G1 ↑ branch The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | | D - D1 - D2 | | | E - E1 - E2 | | F - F1 X | | G - G1 ↑ branch OOPS! Conflict at X. .. class:: incremental ``git-imerge`` needs your help! Please merge E2 and F1 to make a commit F2 The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | | D - D1 - D2 | | | E - E1 - E2 | | F - F1 X | | G - G1 ↑ branch .. class:: incremental The commits share E1 as a common ancestor ("merge base"). You need to add the change made in commit F to state E2... ...or equivalently, add the change made in commit 2 to state F1. The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | A - A1 - A2 | | | B - B1 - B2 | | | C - C1 - C2 | | | D - D1 - D2 | | | E - E1 - E2 | | | F - F1 - F2 | | G - G1 ↑ branch .. class:: incremental Continue in this manner until the diagram is complete... The basic idea (cont'd) ======================= :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - A1 - A2 - A3 - A4 - A5 - A6 - A7 - A8 - A9 - A10 - A11 | | | | | | | | | | | | B - B1 - B2 - B3 - B4 - B5 - B6 - B7 - B8 - B9 - B10 - B11 | | | | | | | | | | | | C - C1 - C2 - C3 - C4 - C5 - C6 - C7 - C8 - C9 - C10 - C11 | | | | | | | | | | | | D - D1 - D2 - D3 - D4 - D5 - D6 - D7 - D8 - D9 - D10 - D11 | | | | | | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 - E7 - E8 - E9 - E10 - E11 | | | | | | | | | | | | F - F1 - F2 - F3 - F4 - F5 - F6 - F7 - F8 - F9 - F10 - F11 | | | | | | | | | | | | G - G1 - G2 - G3 - G4 - G5 - G6 - G7 - G8 - G9 - G10 - G11 ↑ branch .. class:: incremental Done! A completed incremental merge contains all of the information you could possibly want to know about combining two branches. Simplifying the results ======================= .. class:: incremental ...in fact, it knows *too much* information. You probably want to eliminate some of the intermediate information before storing it in your project's permanent record. For example... Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - A1 - A2 - A3 - A4 - A5 - A6 - A7 - A8 - A9 - A10 - A11 | | | | | | | | | | | | B - B1 - B2 - B3 - B4 - B5 - B6 - B7 - B8 - B9 - B10 - B11 | | | | | | | | | | | | C - C1 - C2 - C3 - C4 - C5 - C6 - C7 - C8 - C9 - C10 - C11 | | | | | | | | | | | | D - D1 - D2 - D3 - D4 - D5 - D6 - D7 - D8 - D9 - D10 - D11 | | | | | | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 - E7 - E8 - E9 - E10 - E11 | | | | | | | | | | | | F - F1 - F2 - F3 - F4 - F5 - F6 - F7 - F8 - F9 - F10 - F11 | | | | | | | | | | | | G - G1 - G2 - G3 - G4 - G5 - G6 - G7 - G8 - G9 - G10 - G11 ↑ branch .. class:: incremental Q: Where is the simple merge of "branch" and "master"? A: G11 Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 | | A | | | B | | | C | | | D | | | E | | | F | | | G ---------------------------------------------------- G11' ← master ↑ branch Q: Where is the simple merge of "branch" and "master"? A: G11 Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 | | A | | | B | | | C | | | D | | | E | | | F | | | G ---------------------------------------------------- G11' ← master ↑ branch Usually such a diagram is drawn like so:: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - G11' ← master \ / A ---- B ---- C ----- D ----- E ----- F ----- G ← branch Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - A1 - A2 - A3 - A4 - A5 - A6 - A7 - A8 - A9 - A10 - A11 | | | | | | | | | | | | B - B1 - B2 - B3 - B4 - B5 - B6 - B7 - B8 - B9 - B10 - B11 | | | | | | | | | | | | C - C1 - C2 - C3 - C4 - C5 - C6 - C7 - C8 - C9 - C10 - C11 | | | | | | | | | | | | D - D1 - D2 - D3 - D4 - D5 - D6 - D7 - D8 - D9 - D10 - D11 | | | | | | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 - E7 - E8 - E9 - E10 - E11 | | | | | | | | | | | | F - F1 - F2 - F3 - F4 - F5 - F6 - F7 - F8 - F9 - F10 - F11 | | | | | | | | | | | | G - G1 - G2 - G3 - G4 - G5 - G6 - G7 - G8 - G9 - G10 - G11 ↑ branch .. class:: incremental Q: Where is the rebase of "branch" onto "master"? A: The rightmost column... Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | A11' | B11' | C11' | D11' | E11' | F11' | G11' ← branch Q: Where is the rebase of "branch" onto "master"? A: The rightmost column. Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - A1 - A2 - A3 - A4 - A5 - A6 - A7 - A8 - A9 - A10 - A11 | | | | | | | | | | | | B - B1 - B2 - B3 - B4 - B5 - B6 - B7 - B8 - B9 - B10 - B11 | | | | | | | | | | | | C - C1 - C2 - C3 - C4 - C5 - C6 - C7 - C8 - C9 - C10 - C11 | | | | | | | | | | | | D - D1 - D2 - D3 - D4 - D5 - D6 - D7 - D8 - D9 - D10 - D11 | | | | | | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 - E7 - E8 - E9 - E10 - E11 | | | | | | | | | | | | F - F1 - F2 - F3 - F4 - F5 - F6 - F7 - F8 - F9 - F10 - F11 | | | | | | | | | | | | G - G1 - G2 - G3 - G4 - G5 - G6 - G7 - G8 - G9 - G10 - G11 ↑ branch .. class:: incremental Q: Where is the rebase of "master" onto "branch"? A: The bottommost row... Simplifying the results (cont'd) ================================ :: o - 0 | A | B | C | D | E | F | G - G1'- G2'- G3'- G4'- G5'- G6'- G7'- G8'- G9'- G10'- G11' ← master ↑ branch Q: Where is the rebase of "master" onto "branch"? A: The bottommost row. Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - A1 - A2 - A3 - A4 - A5 - A6 - A7 - A8 - A9 - A10 - A11 | | | | | | | | | | | | B - B1 - B2 - B3 - B4 - B5 - B6 - B7 - B8 - B9 - B10 - B11 | | | | | | | | | | | | C - C1 - C2 - C3 - C4 - C5 - C6 - C7 - C8 - C9 - C10 - C11 | | | | | | | | | | | | D - D1 - D2 - D3 - D4 - D5 - D6 - D7 - D8 - D9 - D10 - D11 | | | | | | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 - E7 - E8 - E9 - E10 - E11 | | | | | | | | | | | | F - F1 - F2 - F3 - F4 - F5 - F6 - F7 - F8 - F9 - F10 - F11 | | | | | | | | | | | | G - G1 - G2 - G3 - G4 - G5 - G6 - G7 - G8 - G9 - G10 - G11 ↑ branch .. class:: incremental If you have already published branch, consider simplifying into a "rebase with history"... Simplifying the results (cont'd) ================================ :: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | A ---------------------------------------------------- A11' | | B ---------------------------------------------------- B11' | | C ---------------------------------------------------- C11' | | D ---------------------------------------------------- D11' | | E ---------------------------------------------------- E11' | | F ---------------------------------------------------- F11' | | G ---------------------------------------------------- G11' ↑ branch .. class:: incremental Rebase-with-history is a useful hybrid between rebasing and merging: * It retains both the old and the new versions of branch. * It can be used even if branch has been published. Efficiency ========== .. class:: incremental In most cases ``git-imerge`` does not have to construct the full incremental merge. It uses an efficient algorithm, based on bisection, for filling in large blocks of the incremental merge quickly and homing in on the conflicts. Efficiency (cont'd) =================== A typical in-progress merge might look like this:: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - A1 - A2 - A3 - A4 - A5 - A6 - A7 - A8 - A9 - A10 - A11 | | | | | | | | | B - B1 - B2 - B3 - B4 - B5 - B6 - B7 - B8 X | | | | | | | C - C1 - C2 - C3 - C4 - C5 - C6 X | | | | | | | D - D1 - D2 - D3 - D4 - D5 - D6 | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 | | F - F1 X | | G - G1 ↑ branch .. class:: incremental * The Xs marks pairwise merges that conflict Efficiency (cont'd) =================== But ``git-imerge`` only needs to compute this:: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - -- -- -- -- -- A6 - -- A8 - A9 - A10 - A11 | | | | | | | | | B - -- -- -- -- -- B6 - B7 - B8 X | | | | | | | C - -- -- -- -- -- C6 X | | | | | | | D - -- -- -- -- -- D6 | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 | | F - F1 X | | G - G1 ↑ branch .. class:: incremental (Plus a few test merges to locate the conflicts.) Efficiency (cont'd) =================== But ``git-imerge`` only needs to compute this:: o - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 ← master | | | | | | | | | | | | A - -- -- -- -- -- A6 - -- A8 - A9 - A10 - A11 | | | | | | | | | B - -- -- -- -- -- B6 - B7 - B8 X | | | | | | | C - -- -- -- -- -- C6 X | | | | | | | D - -- -- -- -- -- D6 | | | | | | | E - E1 - E2 - E3 - E4 - E5 - E6 | | F - F1 X | | G - G1 ↑ branch .. class:: incremental The gaps could be skipped because the merges on the boundaries were all successful. git-imerge demo =============== Time for a simple demo. git-imerge demo =============== Time for a simple demo. You start like ``git merge``:: $ git checkout master $ git imerge start --name=merge-branch --first-parent branch .. class:: incremental Each imerge gets a name. git-imerge demo (cont'd) ======================== ``git-imerge`` uses bisection to find pairwise merges that conflict, filling everything it can:: Attempting automerge of 1-1...success. Attempting automerge of 1-4...success. Attempting automerge of 1-6...success. Attempting automerge of 9-6...failure. Attempting automerge of 5-6...failure. Attempting automerge of 3-6...success. Attempting automerge of 4-6...failure. Attempting automerge of 4-1...success. Attempting automerge of 4-4...failure. Attempting automerge of 4-3...failure. Attempting automerge of 4-2...success. Attempting automerge of 9-2...success. Autofilling 1-6...success. Autofilling 2-6...success. Autofilling 3-1...success. Autofilling 3-2...success. [...] Autofilling 3-6...success. Autofilling 4-2...success. [...] Autofilling 8-2...success. Autofilling 9-1...success. Autofilling 9-2...success. git-imerge demo (cont'd) ======================== When it hits a conflict, it asks for help:: Attempting automerge of 4-3...failure. Switched to branch 'imerge/merge-branch' Auto-merging conflict.txt CONFLICT (add/add): Merge conflict in conflict.txt Automatic merge failed; fix conflicts and then commit the result. Original first commit: commit b7fe8a65d0cee2e388e971c4b29be8c6cbb25ee1 Author: Lou User Date: Fri May 3 14:03:05 2013 +0200 c conflict Original second commit: commit bd0373cadae08d872536bcda8214c0631e19945a Author: Lou User Date: Fri May 3 14:03:05 2013 +0200 d conflict There was a conflict merging commit 4-3, shown above. Please resolve the conflict, commit the result, then type git-imerge continue git-imerge demo (cont'd) ======================== You can get a diagram of the current state of the merge (it is in crude ASCII-art for now):: $ git imerge diagram ********** *??|?????| *--+-----+ *??|#????? *??|?????? *??|?????? *--+?????? Key: |,-,+ = rectangles forming current merge frontier * = merge done manually . = merge done automatically # = conflict that is currently blocking progress @ = merge was blocked but has been resolved ? = no merge recorded git-imerge demo (cont'd) ======================== You fix the conflict then tell ``git-imerge`` to continue:: $ git add ... $ git commit $ git imerge continue Merge has been recorded for merge 4-3. Attempting automerge of 5-3...success. Attempting automerge of 5-3...success. Attempting automerge of 9-3...success. Autofilling 5-3...success. Autofilling 6-3...success. Autofilling 7-3...success. Autofilling 8-3...success. Autofilling 9-3...success. Attempting automerge of 4-4...success. Attempting automerge of 4-5...success. Attempting automerge of 4-6...success. Attempting automerge of 9-6...success. Autofilling 4-6...success. Autofilling 5-6...success. Autofilling 6-6...success. Autofilling 7-6...success. Autofilling 8-6...success. Autofilling 9-4...success. Autofilling 9-5...success. Autofilling 9-6...success. Merge is complete! git-imerge demo (cont'd) ======================== Here is a diagram of the completed merge:: $ git imerge diagram ********** *??.?????| *??......| *??.*....| *??.?????| *??.?????| *--------+ Key: |,-,+ = rectangles forming current merge frontier * = merge done manually . = merge done automatically # = conflict that is currently blocking progress @ = merge was blocked but has been resolved ? = no merge recorded git-imerge demo (cont'd) ======================== Now simplify the incremental merge into a simple merge, a simple rebase, or a rebase-with-history:: $ git imerge finish --goal=merge $ git log -1 --decorate commit 79afd870a52e216114596b52c800e45139badf74 (HEAD, merge-branch) Merge: 8453321 993a8a9 Author: Lou User Date: Wed May 8 10:08:07 2013 +0200 Merge frobnicator into floobifier. Intermediate data ================= During an incremental merge, intermediate results are stored directly in your repository as special references under ``refs/imerge/NAME/``: ``refs/imerge/NAME/state`` A blob containing a little bit of metadata. ``refs/imerge/NAME/{manual,auto}/M-N`` Manual/automatic merge that includes all of the changes through commits ``M`` on master and ``N`` on branch. ``refs/heads/imerge/NAME`` Temporary branch used when resolving merge conflicts. ``refs/heads/NAME`` Default branch where final results are stored. Summary ======= As of this writing, ``git-imerge`` is very new and still experimental. Please try it out, but use it cautiously (e.g., on a clone of your main Git repository). .. class:: incremental | Give me your feedback! | Michael Haggerty | ``mhagger@alum.mit.edu`` | Get involved! | ``https://github.com/mhagger/git-imerge`` | For more details, see my blog "SoftwareSwirl": | ``http://softwareswirl.blogspot.com/`` Thank you for your attention! git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/000077500000000000000000000000001373165437100217235ustar00rootroot00000000000000git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/000077500000000000000000000000001373165437100241515ustar00rootroot00000000000000git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/blank.gif000066400000000000000000000000611373165437100257240ustar00rootroot00000000000000GIF89a!,T;git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/framing.css000066400000000000000000000016551373165437100263150ustar00rootroot00000000000000/* This file has been placed in the public domain. */ /* The following styles size, place, and layer the slide components. Edit these if you want to change the overall slide layout. The commented lines can be uncommented (and modified, if necessary) to help you with the rearrangement process. */ /* target = 1024x768 */ div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} .slide {top: 0; width: 92%; padding: 1em 4% 0 4%; z-index: 2;} div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; margin: 0;} #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;} html>body #currentSlide {position: fixed;} /* div#header {background: #FCC;} div#footer {background: #CCF;} div#controls {background: #BBD;} div#currentSlide {background: #FFC;} */ git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/iepngfix.htc000066400000000000000000000022521373165437100264630ustar00rootroot00000000000000 git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/opera.css000066400000000000000000000004051373165437100257700ustar00rootroot00000000000000/* This file has been placed in the public domain. */ /* DO NOT CHANGE THESE unless you really want to break Opera Show */ .slide { visibility: visible !important; position: static !important; page-break-before: always; } #slide0 {page-break-before: avoid;} git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/outline.css000066400000000000000000000012101373165437100263340ustar00rootroot00000000000000/* This file has been placed in the public domain. */ /* Don't change this unless you want the layout stuff to show up in the outline view! */ .layout div, #footer *, #controlForm * {display: none;} #footer, #controls, #controlForm, #navLinks, #toggle { display: block; visibility: visible; margin: 0; padding: 0;} #toggle {float: right; padding: 0.5em;} html>body #toggle {position: fixed; top: 0; right: 0;} /* making the outline look pretty-ish */ #slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;} #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} .outline {display: inline ! important;} git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/pretty.css000066400000000000000000000076601373165437100262230ustar00rootroot00000000000000/* This file has been placed in the public domain. */ /* Following are the presentation styles -- edit away! */ html, body {margin: 0; padding: 0;} body {background: white; color: black;} :link, :visited {text-decoration: none; color: #00C;} #controls :active {color: #888 !important;} #controls :focus {outline: 1px dotted #222;} h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;} blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em;} blockquote p {margin: 0;} kbd {font-weight: bold; font-size: 1em;} sup {font-size: smaller; line-height: 1px;} .slide pre {padding: 0; margin-left: 0; margin-right: 0; font-size: 90%;} .slide ul ul li {list-style: square;} .slide img.leader {display: block; margin: 0 auto;} .slide tt {font-size: 90%;} div#footer {font-family: sans-serif; color: #444; font-size: 0.5em; font-weight: bold; padding: 1em 0;} #footer h1 {display: block; padding: 0 1em;} #footer h2 {display: block; padding: 0.8em 1em 0;} .slide {font-size: 1.2em;} .slide h1 {padding-top: 0; z-index: 1; margin: 0; font: bold 150% sans-serif;} .slide h2 {font: bold 120% sans-serif; padding-top: 0.5em;} .slide h3 {font: bold 100% sans-serif; padding-top: 0.5em;} h1 abbr {font-variant: small-caps;} div#controls {position: absolute; left: 50%; bottom: 0; width: 50%; text-align: right; font: bold 0.9em sans-serif;} html>body div#controls {position: fixed; padding: 0 0 1em 0; top: auto;} div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; margin: 0; padding: 0;} #controls #navLinks a {padding: 0; margin: 0 0.5em; border: none; color: #888; cursor: pointer;} #controls #navList {height: 1em;} #controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #222;} #currentSlide {text-align: center; font-size: 0.5em; color: #444; font-family: sans-serif; font-weight: bold;} #slide0 {padding-top: 0em} #slide0 h1 {position: static; margin: 1em 0 0; padding: 0; font: bold 2em sans-serif; white-space: normal; background: transparent;} #slide0 h2 {font: bold italic 1em sans-serif; margin: 0.25em;} #slide0 h3 {margin-top: 1.5em; font-size: 1.5em;} #slide0 h4 {margin-top: 0; font-size: 1em;} ul.urls {list-style: none; display: inline; margin: 0;} .urls li {display: inline; margin: 0;} .external {border-bottom: 1px dotted gray;} html>body .external {border-bottom: none;} .external:after {content: " \274F"; font-size: smaller; color: #77B;} .incremental, .incremental *, .incremental *:after { color: white; visibility: visible; border: 0; border: 0;} img.incremental {visibility: hidden;} .slide .current {color: green;} .slide-display {display: inline ! important;} .huge {font-family: sans-serif; font-weight: bold; font-size: 150%;} .big {font-family: sans-serif; font-weight: bold; font-size: 120%;} .small {font-size: 75%;} .tiny {font-size: 50%;} .huge tt, .big tt, .small tt, .tiny tt {font-size: 115%;} .huge pre, .big pre, .small pre, .tiny pre {font-size: 115%;} .maroon {color: maroon;} .red {color: red;} .magenta {color: magenta;} .fuchsia {color: fuchsia;} .pink {color: #FAA;} .orange {color: orange;} .yellow {color: yellow;} .lime {color: lime;} .green {color: green;} .olive {color: olive;} .teal {color: teal;} .cyan {color: cyan;} .aqua {color: aqua;} .blue {color: blue;} .navy {color: navy;} .purple {color: purple;} .black {color: black;} .gray {color: gray;} .silver {color: silver;} .white {color: white;} .left {text-align: left ! important;} .center {text-align: center ! important;} .right {text-align: right ! important;} .animation {position: relative; margin: 1em 0; padding: 0;} .animation img {position: absolute;} /* Docutils-specific overrides */ .slide table.docinfo {margin: 1em 0 0.5em 2em;} pre.literal-block, pre.doctest-block {background-color: #EEE; font-size: 50%;} tt.docutils {background-color: white;} /* diagnostics */ /* li:after {content: " [" attr(class) "]"; color: #F88;} div:before {content: "[" attr(class) "]"; color: #F88;} */ git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/print.css000066400000000000000000000014621373165437100260220ustar00rootroot00000000000000/* This file has been placed in the public domain. */ /* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */ .slide, ul {page-break-inside: avoid; visibility: visible !important;} h1 {page-break-after: avoid;} body {font-size: 12pt; background: white;} * {color: black;} #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} #slide0 h3 {margin: 0; padding: 0;} #slide0 h4 {margin: 0 0 0.5em; padding: 0;} #slide0 {margin-bottom: 3em;} #header {display: none;} #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;} #footer h2, #controls {display: none;} .print {display: inline ! important;} /* The following rule keeps the layout stuff out of print. Remove at your own risk! */ .layout, .layout * {display: none !important;} git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/s5-core.css000066400000000000000000000007031373165437100261400ustar00rootroot00000000000000/* This file has been placed in the public domain. */ /* Do not edit or override these styles! The system will likely break if you do. */ div#header, div#footer, div#controls, .slide {position: absolute;} html>body div#header, html>body div#footer, html>body div#controls, html>body .slide {position: fixed;} .handout {display: none;} .layout {display: block;} .slide, .hideme, .incremental {visibility: hidden;} #slide0 {visibility: visible;} git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/slides.css000066400000000000000000000004331373165437100261460ustar00rootroot00000000000000/* This file has been placed in the public domain. */ /* required to make the slide show run at all */ @import url(s5-core.css); /* sets basic placement and size of slide components */ @import url(framing.css); /* styles that make the slides look good */ @import url(pretty.css); git-imerge-1.2.0/doc/presentations/GitMerge-2013/ui/small-white/slides.js000066400000000000000000000366741373165437100260120ustar00rootroot00000000000000// S5 v1.1 slides.js -- released into the Public Domain // Modified for Docutils (http://docutils.sf.net) by David Goodger // // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for // information about all the wonderful and talented contributors to this code! var undef; var slideCSS = ''; var snum = 0; var smax = 1; var slideIDs = new Array(); var incpos = 0; var number = undef; var s5mode = true; var defaultView = 'slideshow'; var controlVis = 'visible'; var isIE = navigator.appName == 'Microsoft Internet Explorer' ? 1 : 0; var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0; var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0; function hasClass(object, className) { if (!object.className) return false; return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1); } function hasValue(object, value) { if (!object) return false; return (object.search('(^|\\s)' + value + '(\\s|$)') != -1); } function removeClass(object,className) { if (!object) return; object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2); } function addClass(object,className) { if (!object || hasClass(object, className)) return; if (object.className) { object.className += ' '+className; } else { object.className = className; } } function GetElementsWithClassName(elementName,className) { var allElements = document.getElementsByTagName(elementName); var elemColl = new Array(); for (var i = 0; i< allElements.length; i++) { if (hasClass(allElements[i], className)) { elemColl[elemColl.length] = allElements[i]; } } return elemColl; } function isParentOrSelf(element, id) { if (element == null || element.nodeName=='BODY') return false; else if (element.id == id) return true; else return isParentOrSelf(element.parentNode, id); } function nodeValue(node) { var result = ""; if (node.nodeType == 1) { var children = node.childNodes; for (var i = 0; i < children.length; ++i) { result += nodeValue(children[i]); } } else if (node.nodeType == 3) { result = node.nodeValue; } return(result); } function slideLabel() { var slideColl = GetElementsWithClassName('*','slide'); var list = document.getElementById('jumplist'); smax = slideColl.length; for (var n = 0; n < smax; n++) { var obj = slideColl[n]; var did = 'slide' + n.toString(); if (obj.getAttribute('id')) { slideIDs[n] = obj.getAttribute('id'); } else { obj.setAttribute('id',did); slideIDs[n] = did; } if (isOp) continue; var otext = ''; var menu = obj.firstChild; if (!menu) continue; // to cope with empty slides while (menu && menu.nodeType == 3) { menu = menu.nextSibling; } if (!menu) continue; // to cope with slides with only text nodes var menunodes = menu.childNodes; for (var o = 0; o < menunodes.length; o++) { otext += nodeValue(menunodes[o]); } list.options[list.length] = new Option(n + ' : ' + otext, n); } } function currentSlide() { var cs; var footer_nodes; var vis = 'visible'; if (document.getElementById) { cs = document.getElementById('currentSlide'); footer_nodes = document.getElementById('footer').childNodes; } else { cs = document.currentSlide; footer = document.footer.childNodes; } cs.innerHTML = '' + snum + '<\/span> ' + '\/<\/span> ' + '' + (smax-1) + '<\/span>'; if (snum == 0) { vis = 'hidden'; } cs.style.visibility = vis; for (var i = 0; i < footer_nodes.length; i++) { if (footer_nodes[i].nodeType == 1) { footer_nodes[i].style.visibility = vis; } } } function go(step) { if (document.getElementById('slideProj').disabled || step == 0) return; var jl = document.getElementById('jumplist'); var cid = slideIDs[snum]; var ce = document.getElementById(cid); if (incrementals[snum].length > 0) { for (var i = 0; i < incrementals[snum].length; i++) { removeClass(incrementals[snum][i], 'current'); removeClass(incrementals[snum][i], 'incremental'); } } if (step != 'j') { snum += step; lmax = smax - 1; if (snum > lmax) snum = lmax; if (snum < 0) snum = 0; } else snum = parseInt(jl.value); var nid = slideIDs[snum]; var ne = document.getElementById(nid); if (!ne) { ne = document.getElementById(slideIDs[0]); snum = 0; } if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;} if (incrementals[snum].length > 0 && incpos == 0) { for (var i = 0; i < incrementals[snum].length; i++) { if (hasClass(incrementals[snum][i], 'current')) incpos = i + 1; else addClass(incrementals[snum][i], 'incremental'); } } if (incrementals[snum].length > 0 && incpos > 0) addClass(incrementals[snum][incpos - 1], 'current'); ce.style.visibility = 'hidden'; ne.style.visibility = 'visible'; jl.selectedIndex = snum; currentSlide(); number = 0; } function goTo(target) { if (target >= smax || target == snum) return; go(target - snum); } function subgo(step) { if (step > 0) { removeClass(incrementals[snum][incpos - 1],'current'); removeClass(incrementals[snum][incpos], 'incremental'); addClass(incrementals[snum][incpos],'current'); incpos++; } else { incpos--; removeClass(incrementals[snum][incpos],'current'); addClass(incrementals[snum][incpos], 'incremental'); addClass(incrementals[snum][incpos - 1],'current'); } } function toggle() { var slideColl = GetElementsWithClassName('*','slide'); var slides = document.getElementById('slideProj'); var outline = document.getElementById('outlineStyle'); if (!slides.disabled) { slides.disabled = true; outline.disabled = false; s5mode = false; fontSize('1em'); for (var n = 0; n < smax; n++) { var slide = slideColl[n]; slide.style.visibility = 'visible'; } } else { slides.disabled = false; outline.disabled = true; s5mode = true; fontScale(); for (var n = 0; n < smax; n++) { var slide = slideColl[n]; slide.style.visibility = 'hidden'; } slideColl[snum].style.visibility = 'visible'; } } function showHide(action) { var obj = GetElementsWithClassName('*','hideme')[0]; switch (action) { case 's': obj.style.visibility = 'visible'; break; case 'h': obj.style.visibility = 'hidden'; break; case 'k': if (obj.style.visibility != 'visible') { obj.style.visibility = 'visible'; } else { obj.style.visibility = 'hidden'; } break; } } // 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/) function keys(key) { if (!key) { key = event; key.which = key.keyCode; } if (key.which == 84) { toggle(); return; } if (s5mode) { switch (key.which) { case 10: // return case 13: // enter if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return; if (key.target && isParentOrSelf(key.target, 'controls')) return; if(number != undef) { goTo(number); break; } case 32: // spacebar case 34: // page down case 39: // rightkey case 40: // downkey if(number != undef) { go(number); } else if (!incrementals[snum] || incpos >= incrementals[snum].length) { go(1); } else { subgo(1); } break; case 33: // page up case 37: // leftkey case 38: // upkey if(number != undef) { go(-1 * number); } else if (!incrementals[snum] || incpos <= 0) { go(-1); } else { subgo(-1); } break; case 36: // home goTo(0); break; case 35: // end goTo(smax-1); break; case 67: // c showHide('k'); break; } if (key.which < 48 || key.which > 57) { number = undef; } else { if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return; if (key.target && isParentOrSelf(key.target, 'controls')) return; number = (((number != undef) ? number : 0) * 10) + (key.which - 48); } } return false; } function clicker(e) { number = undef; var target; if (window.event) { target = window.event.srcElement; e = window.event; } else target = e.target; if (target.href != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target, 'object')) return true; if (!e.which || e.which == 1) { if (!incrementals[snum] || incpos >= incrementals[snum].length) { go(1); } else { subgo(1); } } } function findSlide(hash) { var target = document.getElementById(hash); if (target) { for (var i = 0; i < slideIDs.length; i++) { if (target.id == slideIDs[i]) return i; } } return null; } function slideJump() { if (window.location.hash == null || window.location.hash == '') { currentSlide(); return; } if (window.location.hash == null) return; var dest = null; dest = findSlide(window.location.hash.slice(1)); if (dest == null) { dest = 0; } go(dest - snum); } function fixLinks() { var thisUri = window.location.href; thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length); var aelements = document.getElementsByTagName('A'); for (var i = 0; i < aelements.length; i++) { var a = aelements[i].href; var slideID = a.match('\#.+'); if ((slideID) && (slideID[0].slice(0,1) == '#')) { var dest = findSlide(slideID[0].slice(1)); if (dest != null) { if (aelements[i].addEventListener) { aelements[i].addEventListener("click", new Function("e", "if (document.getElementById('slideProj').disabled) return;" + "go("+dest+" - snum); " + "if (e.preventDefault) e.preventDefault();"), true); } else if (aelements[i].attachEvent) { aelements[i].attachEvent("onclick", new Function("", "if (document.getElementById('slideProj').disabled) return;" + "go("+dest+" - snum); " + "event.returnValue = false;")); } } } } } function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName('a'); for (var i=0; i' + '