chiark / gitweb /
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 200448bbc71c4202835b27aa9f5c17b9980557c4..587c8c46cd626e9eddcacb665d7406e7780bd4d6 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 33010d9b90c164680c71b2fd00396c1218b162b7..2ae4dd57994e8bba9cfc7fcd1ca01eb1ccda55bb 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 cabd5e8bc9a2fb309b32d4956bf19fd2dc48538a..34162f42618944e1f62625230d4e5640d9b6845d 100755 (executable)
@@ -68,9 +68,20 @@ test_expect_success \
        stg log | grep -q -e "^push(m)  "
        '
 
+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 "
        '