hgext/evolve.py
branchstable
changeset 553 e29561d918a6
parent 552 f7e54d4a3b90
child 554 39eb12bb47c0
--- 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
 
-    <relations> must be an iterable of (<old>, (<new>, ...)) tuple.
-    `old` and `news` are changectx.
+        <relations> must be an iterable of (<old>, (<new>, ...)) 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