Mercurial > evolve
comparison hgext/evolve.py @ 1502:094b54a72c1d
next/prev: properly lock repo before touching bookmarks
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 14 Sep 2015 13:48:34 -0700 |
parents | b4dfafda72c2 |
children | 415a51ac07a7 |
comparison
equal
deleted
inserted
replaced
1500:b4dfafda72c2 | 1502:094b54a72c1d |
---|---|
2016 if shouldmove: | 2016 if shouldmove: |
2017 ui.write('hg bookmark %s -r %s;\n' % (bm, p.rev())) | 2017 ui.write('hg bookmark %s -r %s;\n' % (bm, p.rev())) |
2018 else: | 2018 else: |
2019 ret = hg.update(repo, p.rev()) | 2019 ret = hg.update(repo, p.rev()) |
2020 if not ret: | 2020 if not ret: |
2021 if shouldmove: | 2021 wlock = repo.wlock() |
2022 repo._bookmarks[bm] = p.node() | 2022 try: |
2023 repo._bookmarks.write() | 2023 if shouldmove: |
2024 else: | 2024 repo._bookmarks[bm] = p.node() |
2025 bmdeactivate(repo) | 2025 repo._bookmarks.write() |
2026 else: | |
2027 bmdeactivate(repo) | |
2028 finally: | |
2029 wlock.release() | |
2026 displayer.show(p) | 2030 displayer.show(p) |
2027 return 0 | 2031 return 0 |
2028 else: | 2032 else: |
2029 for p in parents: | 2033 for p in parents: |
2030 displayer.show(p) | 2034 displayer.show(p) |
2067 if shouldmove: | 2071 if shouldmove: |
2068 ui.write('hg bookmark %s -r %s;\n' % (bm, c.rev())) | 2072 ui.write('hg bookmark %s -r %s;\n' % (bm, c.rev())) |
2069 else: | 2073 else: |
2070 ret = hg.update(repo, c.rev()) | 2074 ret = hg.update(repo, c.rev()) |
2071 if not ret: | 2075 if not ret: |
2072 if shouldmove: | 2076 wlock = repo.wlock() |
2073 repo._bookmarks[bm] = c.node() | 2077 try: |
2074 repo._bookmarks.write() | 2078 if shouldmove: |
2075 else: | 2079 repo._bookmarks[bm] = c.node() |
2076 bmdeactivate(repo) | 2080 repo._bookmarks.write() |
2081 else: | |
2082 bmdeactivate(repo) | |
2083 finally: | |
2084 wlock.release() | |
2077 displayer.show(c) | 2085 displayer.show(c) |
2078 result = 0 | 2086 result = 0 |
2079 elif children: | 2087 elif children: |
2080 ui.warn("ambigious next changeset:\n") | 2088 ui.warn("ambigious next changeset:\n") |
2081 for c in children: | 2089 for c in children: |