git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [StGit PATCH 3/5] Add automatic git-mergetool invocation to the new infrastructure

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Mar 16, 2009, 15:03 UTC
Message-ID
<b0943d9e0903160803y25eb3f45y96d68e734b22e5f9@mail.gmail.com>
In-Reply-To
<20090313021751.GC15393@diana.vm.bytemark.co.uk>
2009/3/13 Karl Hasselström <kha@treskal.com>:
Show 12 quoted lines
> On 2009-03-12 12:09:07 +0000, Catalin Marinas wrote:
>>                  # There were conflicts
>> -                conflicts = [l for l in output if l.startswith('CONFLICT')]
>> -                raise MergeConflictException(conflicts)
>> +                if interactive:
>> +                    self.mergetool()
>> +                else:
>> +                    conflicts = [l for l in output if l.startswith('CONFLICT')]
>> +                    raise MergeConflictException(conflicts)
>
> Does the merge tool always resolve all conflicts? If it doesn't, the
> two lines in the "else" branch should probably be run unconditionally.
[...]
Show 12 quoted lines
>> +        # check for unmerged entries (prepend 'CONFLICT ' for consistency with
>> +        # merge())
>> +        conflicts = ['CONFLICT ' + f for f in self.index.conflicts()]
>> +        if conflicts:
>> +            raise MergeConflictException(conflicts)
>> +        elif err:
>> +            raise MergeException('"git mergetool" failed, exit code: %d' % err)
>
> Ah, you take care of conflicts here too. Hmm. I guess that's fine too,
> though there is some code duplication. Maybe a helper function that
> takes output as a parameter, and raises MergeConflictException if
> necessary?

The non-interactive path assumes that there are conflicts if "git merge-recursive" returned an error and it simply splits the output if this command. The mergetool path has to run "git ls-files --unmerged" to check if there were any left conflicts. I wouldn't call "git ls-files" in the first case as we already have the information.

-- 
Catalin
Previous: Karl HasselströmNext: Karl Hasselström
Message 12 of 19 in “Various StGit patches”
  1. 0/5 Various StGit patchesCatalin Marinas, Mar 12, 2009
  2. 1/5 Check for local changes with "goto"Catalin Marinas, Mar 12, 2009
  3. Karl HasselströmMar 13, 2009
  4. Catalin MarinasMar 16, 2009
  5. Karl HasselströmMar 17, 2009
  6. Catalin MarinasMar 17, 2009
  7. Karl HasselströmMar 17, 2009
  8. 2/5 Add mergetool support to the classic StGit infrastructureCatalin Marinas, Mar 12, 2009
  9. Karl HasselströmMar 13, 2009
  10. 3/5 Add automatic git-mergetool invocation to the new infrastructureCatalin Marinas, Mar 12, 2009
  11. Karl HasselströmMar 13, 2009
  12. Catalin MarinasMar 16, 2009
  13. Karl HasselströmMar 17, 2009
  14. 4/5 Convert "sink" to the new infrastructureCatalin Marinas, Mar 12, 2009
  15. Karl HasselströmMar 13, 2009
  16. 5/5 Convert "float" to the lib infrastructureCatalin Marinas, Mar 12, 2009
  17. Karl HasselströmMar 13, 2009
  18. Catalin MarinasMar 16, 2009
  19. Karl HasselströmMar 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.