From 0f4eba6a37c1a5454560b097873e5a22bfcde908 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 12 Jan 2007 23:10:44 +0000 Subject: [PATCH] Track the files conflict history 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 --- stgit/gitmergeonefile.py | 1 + stgit/stack.py | 5 +++++ t/t1400-patch-history.sh | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py index 200448bb..587c8c46 100644 --- a/stgit/gitmergeonefile.py +++ b/stgit/gitmergeonefile.py @@ -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: diff --git a/stgit/stack.py b/stgit/stack.py index 33010d9b..2ae4dd57 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -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 diff --git a/t/t1400-patch-history.sh b/t/t1400-patch-history.sh index cabd5e8b..34162f42 100755 --- a/t/t1400-patch-history.sh +++ b/t/t1400-patch-history.sh @@ -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 " ' -- 2.11.4.GIT