# HG changeset patch # User Pierre-Yves David # Date 1347359929 -7200 # Node ID e29561d918a6354a4558d23414036f5e5a5e88df # Parent f7e54d4a3b90f176e4e6746e13c43d5e79e40c9c createmarkers: adapt to f85816af6294 in core The createmarkers function is now in core. Fallback on our function if not available diff -r f7e54d4a3b90 -r e29561d918a6 hgext/evolve.py --- a/hgext/evolve.py Tue Sep 11 12:30:22 2012 +0200 +++ b/hgext/evolve.py Tue Sep 11 12:38:49 2012 +0200 @@ -623,40 +623,43 @@ # - function to find useful changeset to stabilize ### Marker Create - -def createmarkers(repo, relations, metadata=None, flag=0): - """Add obsolete markers between changeset in a repo +# NOW IN CORE f85816af6294 +try: + createmarkers = obsolete.createmarkers +except AttributeError: + def createmarkers(repo, relations, metadata=None, flag=0): + """Add obsolete markers between changeset in a repo - must be an iterable of (, (, ...)) tuple. - `old` and `news` are changectx. + must be an iterable of (, (, ...)) tuple. + `old` and `news` are changectx. - Current user and date are used except if specified otherwise in the - metadata attribute. + Current user and date are used except if specified otherwise in the + metadata attribute. - /!\ assume the repo have been locked by the user /!\ - """ - # prepare metadata - if metadata is None: - metadata = {} - if 'date' not in metadata: - metadata['date'] = '%i %i' % util.makedate() - if 'user' not in metadata: - metadata['user'] = repo.ui.username() - # check future marker - tr = repo.transaction('add-obsolescence-marker') - try: - for prec, sucs in relations: - if not prec.mutable(): - raise util.Abort("Cannot obsolete immutable changeset: %s" % prec) - nprec = prec.node() - nsucs = tuple(s.node() for s in sucs) - if nprec in nsucs: - raise util.Abort("Changeset %s cannot obsolete himself" % prec) - repo.obsstore.create(tr, nprec, nsucs, flag, metadata) - clearobscaches(repo) - tr.close() - finally: - tr.release() + /!\ assume the repo have been locked by the user /!\ + """ + # prepare metadata + if metadata is None: + metadata = {} + if 'date' not in metadata: + metadata['date'] = '%i %i' % util.makedate() + if 'user' not in metadata: + metadata['user'] = repo.ui.username() + # check future marker + tr = repo.transaction('add-obsolescence-marker') + try: + for prec, sucs in relations: + if not prec.mutable(): + raise util.Abort("cannot obsolete immutable changeset: %s" % prec) + nprec = prec.node() + nsucs = tuple(s.node() for s in sucs) + if nprec in nsucs: + raise util.Abort("changeset %s cannot obsolete himself" % prec) + repo.obsstore.create(tr, nprec, nsucs, flag, metadata) + clearobscaches(repo) + tr.close() + finally: + tr.release() ### Useful alias diff -r f7e54d4a3b90 -r e29561d918a6 tests/test-evolve.t --- a/tests/test-evolve.t Tue Sep 11 12:30:22 2012 +0200 +++ b/tests/test-evolve.t Tue Sep 11 12:38:49 2012 +0200 @@ -58,7 +58,7 @@ $ hg log -r 1 --template '{rev} {phase} {obsolete}\n' 1 public stable $ hg kill 1 - abort: Cannot obsolete immutable changeset: 7c3bad9141dc + abort: cannot obsolete immutable changeset: 7c3bad9141dc [255] $ hg log -r 1 --template '{rev} {phase} {obsolete}\n' 1 public stable