jenkins-bot has submitted this change and it was merged.
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
Conflicts:
pywikibot/page.py
Change-Id: I2d8b69a3894aaf6d58a62ecba48f5dc584617e82
(manually cherry picked from 38ae920a24be3)
---
M pywikibot/page.py
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
Lokal Profil: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 5be034b..313bd56 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -4115,6 +4115,7 @@
**kwargs)
# TODO: Re-create the entire item from JSON, not just id
self.snak = data['claim']['id']
+ self.on_item.lastrevid = data['pageinfo']['lastrevid']
def getTarget(self):
"""
@@ -4194,10 +4195,10 @@
@type claims: list of pywikibot.Claim
"""
data = self.repo.editSource(self, claims, new=True, **kwargs)
+ self.on_item.lastrevid = data['pageinfo']['lastrevid']
source = defaultdict(list)
for claim in claims:
claim.hash = data['reference']['hash']
- self.on_item.lastrevid = data['pageinfo']['lastrevid']
source[claim.getID()].append(claim)
self.sources.append(source)
@@ -4217,7 +4218,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.lastrevid = 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/243515
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2d8b69a3894aaf6d58a62ecba48f5dc584617e82
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <lokal.profil(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>