Mercurial > evolve
changeset 2906:92566275be77
convertbookmark: extract the revset into a module level constant
This will make it easier to read and modify the query.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 01 Sep 2017 17:09:17 +0200 |
parents | 610d06bcd714 |
children | d617128279f6 |
files | hgext3rd/topic/__init__.py |
diffstat | 1 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Fri Sep 01 17:04:21 2017 +0200 +++ b/hgext3rd/topic/__init__.py Fri Sep 01 17:09:17 2017 +0200 @@ -517,6 +517,23 @@ finally: lockmod.release(tr, lock, wlock) +# inspired from mercurial.repair.stripbmrevset +CONVERTBOOKREVSET = """ +not public() and ( + ancestors(bookmark(%s)) + and not ( + ancestors( + head() + and not bookmark(%s) + ) + or ancestors( + bookmark() + and not bookmark(%s) + ) + ) +) +""" + def _convertbmarktopic(ui, repo, rev, bmark, tr): """Sets a topic as same as bname to all the changesets under the bookmark and delete the bookmark, if topic is set to any changeset @@ -524,11 +541,7 @@ rev is the revision on which bookmark bmark is and tr is transaction object. """ - # copied from mercurial.repair.stripbmrevset - bookrevset = ("not public() and (ancestors(bookmark(%s)) - ancestors(head()" - "and not bookmark(%s)) - ancestors(bookmark()" - "and not bookmark(%s)))") - touchedrevs = repo.revs(bookrevset, bmark, bmark, bmark) + touchedrevs = repo.revs(CONVERTBOOKREVSET, bmark, bmark, bmark) rewrote = _changetopics(ui, repo, touchedrevs, bmark) # We didn't changed topic to any changesets because the revset # returned an empty set of revisions, so let's skip deleting the