##// END OF EJS Templates
createmarkers: allow to pass metadata for a marker only...
Pierre-Yves David -
r20517:2158e8f3 default
parent child Browse files
Show More
@@ -811,8 +811,10 b' def _computedivergentset(repo):'
811 811 def createmarkers(repo, relations, flag=0, metadata=None):
812 812 """Add obsolete markers between changesets in a repo
813 813
814 <relations> must be an iterable of (<old>, (<new>, ...)) tuple.
815 `old` and `news` are changectx.
814 <relations> must be an iterable of (<old>, (<new>, ...)[,{metadata}])
815 tuple. `old` and `news` are changectx. metadata is an optional dictionnary
816 containing metadata for this marker only. It is merged with the global
817 metadata specified through the `metadata` argument of this function,
816 818
817 819 Trying to obsolete a public changeset will raise an exception.
818 820
@@ -831,7 +833,13 b' def createmarkers(repo, relations, flag='
831 833 metadata['user'] = repo.ui.username()
832 834 tr = repo.transaction('add-obsolescence-marker')
833 835 try:
834 for prec, sucs in relations:
836 for rel in relations:
837 prec = rel[0]
838 sucs = rel[1]
839 localmetadata = metadata.copy()
840 if 2 < len(rel):
841 localmetadata.update(rel[2])
842
835 843 if not prec.mutable():
836 844 raise util.Abort("cannot obsolete immutable changeset: %s"
837 845 % prec)
@@ -839,7 +847,7 b' def createmarkers(repo, relations, flag='
839 847 nsucs = tuple(s.node() for s in sucs)
840 848 if nprec in nsucs:
841 849 raise util.Abort("changeset %s cannot obsolete itself" % prec)
842 repo.obsstore.create(tr, nprec, nsucs, flag, metadata)
850 repo.obsstore.create(tr, nprec, nsucs, flag, localmetadata)
843 851 repo.filteredrevcache.clear()
844 852 tr.close()
845 853 finally:
General Comments 0
You need to be logged in to leave comments. Login now