Tobias Gritschacher has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/100593


Change subject: Fix conflict resolution when the patch is empty.
......................................................................

Fix conflict resolution when the patch is empty.

Previosuly, an empty patch would result in a rever to the base revision,
instead of keepign the current revision.

Change-Id: I1d71775638fe2b6318fc22e6f2ac921104ffeef7
---
M repo/includes/EditEntity.php
M repo/tests/phpunit/includes/EditEntityTest.php
2 files changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/93/100593/1

diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php
index bce7ea0..7799bf9 100644
--- a/repo/includes/EditEntity.php
+++ b/repo/includes/EditEntity.php
@@ -477,7 +477,8 @@
 
                if ( $patch->isEmpty() ) {
                        // we didn't technically fix anything, but if there is 
nothing to change,
-                       // the edit will apply cleanly.
+                       // so just keep the current content as it is.
+                       $this->newContent = $this->getCurrentContent()->copy();
                        return true;
                }
 
diff --git a/repo/tests/phpunit/includes/EditEntityTest.php 
b/repo/tests/phpunit/includes/EditEntityTest.php
index d08fbbe..b2ad831 100644
--- a/repo/tests/phpunit/includes/EditEntityTest.php
+++ b/repo/tests/phpunit/includes/EditEntityTest.php
@@ -191,6 +191,18 @@
                                false, // expected fix
                                null   // expected data
                        ),
+                       array( // #6: case VI: patch is empty, keep current 
(not base)
+                               array( // input data
+                                       'label' => array( 'en' => 'bar', 'de' 
=> 'bar' ),
+                               ),
+                               2,     // base rev index
+                               true,  // expected conflict
+                               true,  // expected fix
+                               array( // expected data
+                                       'label' => array( 'en' => 'test', 'de' 
=> 'bar' ),
+                                       'description' => array( 'en' => 'more 
testing' )
+                               )
+                       ),
                );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/100593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d71775638fe2b6318fc22e6f2ac921104ffeef7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.23-wmf6
Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to