equal
deleted
inserted
replaced
49 raw = ''.join(obsinhibit) |
49 raw = ''.join(obsinhibit) |
50 fp.write(raw) |
50 fp.write(raw) |
51 tr.addfilegenerator('obsinhibit', ('obsinhibit',), writer) |
51 tr.addfilegenerator('obsinhibit', ('obsinhibit',), writer) |
52 tr.hookargs['obs_inbihited'] = '1' |
52 tr.hookargs['obs_inbihited'] = '1' |
53 |
53 |
|
54 def _filterpublic(repo, nodes): |
|
55 """filter out inhibitor on public changeset |
|
56 |
|
57 Public changesets are already immune to obsolescence""" |
|
58 getrev = repo.changelog.nodemap.get |
|
59 getphase = repo._phasecache.phase |
|
60 return (n for n in repo._obsinhibit if getphase(repo, getrev(n))) |
|
61 |
54 def _inhibitmarkers(repo, nodes): |
62 def _inhibitmarkers(repo, nodes): |
55 """add marker inhibitor for all obsolete revision under <nodes> |
63 """add marker inhibitor for all obsolete revision under <nodes> |
56 |
64 |
57 Content of <nodes> and all mutable ancestors are considered. Marker for |
65 Content of <nodes> and all mutable ancestors are considered. Marker for |
58 obsolete revision only are created. |
66 obsolete revision only are created. |
60 newinhibit = repo.set('::%ln and obsolete()', nodes) |
68 newinhibit = repo.set('::%ln and obsolete()', nodes) |
61 if newinhibit: |
69 if newinhibit: |
62 tr = repo.transaction('obsinhibit') |
70 tr = repo.transaction('obsinhibit') |
63 try: |
71 try: |
64 repo._obsinhibit.update(c.node() for c in newinhibit) |
72 repo._obsinhibit.update(c.node() for c in newinhibit) |
65 _schedulewrite(tr, repo._obsinhibit) |
73 _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit)) |
66 repo.invalidatevolatilesets() |
74 repo.invalidatevolatilesets() |
67 tr.close() |
75 tr.close() |
68 finally: |
76 finally: |
69 tr.release() |
77 tr.release() |
70 |
78 |
77 deinhibited = repo._obsinhibit & set(nodes) |
85 deinhibited = repo._obsinhibit & set(nodes) |
78 if deinhibited: |
86 if deinhibited: |
79 tr = repo.transaction('obsinhibit') |
87 tr = repo.transaction('obsinhibit') |
80 try: |
88 try: |
81 repo._obsinhibit -= deinhibited |
89 repo._obsinhibit -= deinhibited |
82 _schedulewrite(tr, repo._obsinhibit) |
90 _schedulewrite(tr, _filterpublic(repo, repo._obsinhibit)) |
83 repo.invalidatevolatilesets() |
91 repo.invalidatevolatilesets() |
84 tr.close() |
92 tr.close() |
85 finally: |
93 finally: |
86 tr.release() |
94 tr.release() |
87 |
95 |