hgext3rd/evolve/rewriteutil.py
changeset 2757 2878c8a686ab
parent 2756 f4dd6e6d4c73
child 2758 684feae20be5
equal deleted inserted replaced
2756:f4dd6e6d4c73 2757:2878c8a686ab
     8 # Status: Stabilization of the API in progress
     8 # Status: Stabilization of the API in progress
     9 #
     9 #
    10 #   The content of this module should move into core incrementally once we are
    10 #   The content of this module should move into core incrementally once we are
    11 #   happy one piece of it (and hopefully, able to reuse it in other core
    11 #   happy one piece of it (and hopefully, able to reuse it in other core
    12 #   commands).
    12 #   commands).
       
    13 
       
    14 from mercurial import (
       
    15     obsolete,
       
    16     revset,
       
    17 )
    13 
    18 
    14 from . import (
    19 from . import (
    15     compat,
    20     compat,
    16 )
    21 )
    17 
    22 
    23         oldbookmarks = repo.nodebookmarks(oldid)
    28         oldbookmarks = repo.nodebookmarks(oldid)
    24         bmchanges = [(b, newid) for b in oldbookmarks]
    29         bmchanges = [(b, newid) for b in oldbookmarks]
    25         if bmchanges:
    30         if bmchanges:
    26             compat.bookmarkapplychanges(repo, tr, bmchanges)
    31             compat.bookmarkapplychanges(repo, tr, bmchanges)
    27     return updatebookmarks
    32     return updatebookmarks
       
    33 
       
    34 def disallowednewunstable(repo, revs):
       
    35     """Check that editing <revs> will not create disallowed unstable
       
    36 
       
    37     (unstable creation is controled by some special config).
       
    38     """
       
    39     allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
       
    40     if allowunstable:
       
    41         return revset.baseset()
       
    42     return repo.revs("(%ld::) - %ld", revs, revs)