Lokal Profil has uploaded a new change for review.

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

Change subject: Update revId upon claim change
......................................................................

Update revId upon claim change

changeTarget, removeSources: Prevents edit conflicts
addSources: No need to set every time through the loop

Change-Id: I2d8b69a3894aaf6d58a62ecba48f5dc584617e82
---
M pywikibot/page.py
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/72/239572/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 2c697c0..68c8dff 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4259,6 +4259,7 @@
                                            **kwargs)
         # TODO: Re-create the entire item from JSON, not just id
         self.snak = data['claim']['id']
+        self.on_item.latest_revision_id = data['pageinfo']['lastrevid']
 
     def getTarget(self):
         """
@@ -4338,10 +4339,10 @@
         @type claims: list of pywikibot.Claim
         """
         data = self.repo.editSource(self, claims, new=True, **kwargs)
+        self.on_item.latest_revision_id = data['pageinfo']['lastrevid']
         source = defaultdict(list)
         for claim in claims:
             claim.hash = data['reference']['hash']
-            self.on_item.latest_revision_id = data['pageinfo']['lastrevid']
             source[claim.getID()].append(claim)
         self.sources.append(source)
 
@@ -4361,7 +4362,8 @@
         @param sources: the sources to remove
         @type sources: list of pywikibot.Claim
         """
-        self.repo.removeSources(self, sources, **kwargs)
+        data = self.repo.removeSources(self, sources, **kwargs)
+        self.on_item.latest_revision_id = data['pageinfo']['lastrevid']
         for source in sources:
             source_dict = defaultdict(list)
             source_dict[source.getID()].append(source)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d8b69a3894aaf6d58a62ecba48f5dc584617e82
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Lokal Profil <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to