##// END OF EJS Templates
effectflag: detect when meta changed...
Boris Feld -
r34421:95759620 default
parent child Browse files
Show More
@@ -7,6 +7,8 b''
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import re
11
10 from . import (
12 from . import (
11 phases,
13 phases,
12 util
14 util
@@ -309,11 +311,27 b' def foreground(repo, nodes):'
309 EFFECTFLAGFIELD = "ef1"
311 EFFECTFLAGFIELD = "ef1"
310
312
311 DESCCHANGED = 1 << 0 # action changed the description
313 DESCCHANGED = 1 << 0 # action changed the description
314 METACHANGED = 1 << 1 # action change the meta
312 PARENTCHANGED = 1 << 2 # action change the parent
315 PARENTCHANGED = 1 << 2 # action change the parent
313 USERCHANGED = 1 << 4 # the user changed
316 USERCHANGED = 1 << 4 # the user changed
314 DATECHANGED = 1 << 5 # the date changed
317 DATECHANGED = 1 << 5 # the date changed
315 BRANCHCHANGED = 1 << 6 # the branch changed
318 BRANCHCHANGED = 1 << 6 # the branch changed
316
319
320 METABLACKLIST = [
321 re.compile('^branch$'),
322 re.compile('^.*-source$'),
323 re.compile('^.*_source$'),
324 re.compile('^source$'),
325 ]
326
327 def metanotblacklisted(metaitem):
328 """ Check that the key of a meta item (extrakey, extravalue) does not
329 match at least one of the blacklist pattern
330 """
331 metakey = metaitem[0]
332
333 return not any(pattern.match(metakey) for pattern in METABLACKLIST)
334
317 def geteffectflag(relation):
335 def geteffectflag(relation):
318 """ From an obs-marker relation, compute what changed between the
336 """ From an obs-marker relation, compute what changed between the
319 predecessor and the successor.
337 predecessor and the successor.
@@ -343,6 +361,16 b' def geteffectflag(relation):'
343 if changectx.parents() != source.parents():
361 if changectx.parents() != source.parents():
344 effects |= PARENTCHANGED
362 effects |= PARENTCHANGED
345
363
364 # Check if other meta has changed
365 changeextra = changectx.extra().items()
366 ctxmeta = filter(metanotblacklisted, changeextra)
367
368 sourceextra = source.extra().items()
369 srcmeta = filter(metanotblacklisted, sourceextra)
370
371 if ctxmeta != srcmeta:
372 effects |= METACHANGED
373
346 return effects
374 return effects
347
375
348 def getobsoleted(repo, tr):
376 def getobsoleted(repo, tr):
@@ -164,4 +164,4 b' amend closing the branch should be detec'
164 check result
164 check result
165
165
166 $ hg debugobsolete -r .
166 $ hg debugobsolete -r .
167 2f599e54c1c6974299065cdf54e1ad640bfb7b5d 12c6238b5e371eea00fd2013b12edce3f070928b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'amend', 'user': 'test'}
167 2f599e54c1c6974299065cdf54e1ad640bfb7b5d 12c6238b5e371eea00fd2013b12edce3f070928b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '2', 'operation': 'amend', 'user': 'test'}
General Comments 0
You need to be logged in to leave comments. Login now