obsolete: add createmarkers option
The basic obsolete option is allowing the creation of obsolete markers. This
does not enable other features, such as allowing unstable commits or exchanging
obsolete markers.
--- a/hgext/histedit.py Tue Oct 14 13:20:31 2014 -0700
+++ b/hgext/histedit.py Tue Oct 14 13:23:52 2014 -0700
@@ -640,7 +640,7 @@
if mapping:
movebookmarks(ui, repo, mapping, topmost, ntm)
# TODO update mq state
- if obsolete._enabled:
+ if obsolete.isenabled(repo, obsolete.createmarkersopt):
markers = []
# sort by revision number because it sound "right"
for prec in sorted(mapping, key=repo.changelog.rev):
--- a/hgext/rebase.py Tue Oct 14 13:20:31 2014 -0700
+++ b/hgext/rebase.py Tue Oct 14 13:23:52 2014 -0700
@@ -928,7 +928,7 @@
If `collapsedas` is not None, the rebase was a collapse whose result if the
`collapsedas` node."""
- if obsolete._enabled:
+ if obsolete.isenabled(repo, obsolete.createmarkersopt):
markers = []
for rev, newrev in sorted(state.items()):
if newrev >= 0:
--- a/mercurial/cmdutil.py Tue Oct 14 13:20:31 2014 -0700
+++ b/mercurial/cmdutil.py Tue Oct 14 13:23:52 2014 -0700
@@ -2283,7 +2283,8 @@
marks[bm] = newid
marks.write()
#commit the whole amend process
- if obsolete._enabled and newid != old.node():
+ createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
+ if createmarkers and newid != old.node():
# mark the new changeset as successor of the rewritten one
new = repo[newid]
obs = [(old, (new,))]
@@ -2294,7 +2295,7 @@
tr.close()
finally:
tr.release()
- if (not obsolete._enabled) and newid != old.node():
+ if not createmarkers and newid != old.node():
# Strip the intermediate commit (if there was one) and the amended
# commit
if node:
--- a/mercurial/localrepo.py Tue Oct 14 13:20:31 2014 -0700
+++ b/mercurial/localrepo.py Tue Oct 14 13:23:52 2014 -0700
@@ -406,9 +406,10 @@
kwargs = {}
if defaultformat is not None:
kwargs['defaultformat'] = defaultformat
- store = obsolete.obsstore(self.sopener, readonly=not obsolete._enabled,
+ readonly = not obsolete.isenabled(self, obsolete.createmarkersopt)
+ store = obsolete.obsstore(self.sopener, readonly=readonly,
**kwargs)
- if store and not obsolete._enabled:
+ if store and readonly:
# message is rare enough to not be translated
msg = 'obsolete feature not enabled but %i markers found!\n'
self.ui.warn(msg % len(list(store)))
--- a/mercurial/obsolete.py Tue Oct 14 13:20:31 2014 -0700
+++ b/mercurial/obsolete.py Tue Oct 14 13:23:52 2014 -0700
@@ -81,6 +81,9 @@
# you have to rely on third party extension extension to enable this.
_enabled = False
+# Options for obsolescence
+createmarkersopt = 'createmarkers'
+
### obsolescence marker flag
## bumpedfix flag