Track the files conflict history
authorCatalin Marinas <catalin.marinas@gmail.com>
Fri, 12 Jan 2007 23:10:44 +0000 (23:10 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Fri, 12 Jan 2007 23:10:44 +0000 (23:10 +0000)
This commit refreshes a pushed patch even if there was a conflict (in
which case only the correctly merged files are merged). The refresh
after fixing the conflict would log the conflict files in the patch
history.

The patch also updates the index in the case of the interactive merge.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/gitmergeonefile.py
stgit/stack.py
t/t1400-patch-history.sh

index 200448b..587c8c4 100644 (file)
@@ -199,6 +199,7 @@ def merge(orig_hash, file1_hash, file2_hash,
                             __conflict(path)
                             return 1
                         # successful interactive merge
+                        os.system('git-update-index -- %s' % path)
                         __remove_files(orig_hash, file1_hash, file2_hash)
                         return 0
                     else:
index 33010d9..2ae4dd5 100644 (file)
@@ -959,6 +959,11 @@ class Series(StgitObject):
                     log = 'push'
                 self.refresh_patch(cache_update = False, log = log)
             else:
+                # we store the correctly merged files only for
+                # tracking the conflict history. Note that the
+                # git.merge() operations shouls always leave the index
+                # in a valid state (i.e. only stage 0 files)
+                self.refresh_patch(cache_update = False, log = 'push(c)')
                 raise StackException, str(ex)
 
         return modified
index cabd5e8..34162f4 100755 (executable)
@@ -69,8 +69,19 @@ test_expect_success \
        '
 
 test_expect_success \
+       'Check the "push(c)" log' \
+       '
+       echo bar > test && stg refresh &&
+       stg pop &&
+       echo foo > test && stg refresh &&
+       ! stg push &&
+       stg log | grep -q -e "^push(c)  "
+       '
+
+test_expect_success \
        'Check the push "undo" log' \
        '
+       stg status --reset &&
        stg push --undo &&
        stg log bar | grep -q -e "^undo "
        '