Angel Ezquerra avatar Angel Ezquerra committed cb042a8

Support all mercurial 'boolean' strings when on the 'confirm' setting

You can now use 'on', 'yes' or '1' (in addition to 'true' and 'always') and
'off', 'no' or '0' (in addition to 'false' and 'never').

Comments (0)

Files changed (2)

 :``never`` / ``False``: Never ask for confirmation (accept all projrc
                         changes).
 
-Note that if this key is not set, the user will have to confirm all
+Note that you can use any valid mercurial configuration 'boolean'
+value in addition to ``always`` and ``never`` (i.e. you can use
+``yes``, ``on``, ``1``, ``no``, ``off`` and ``0``).
+
+Also note that if this key is not set, the user will have to confirm all
 changes (i.e. ``always`` is the default setting)
 
 Set this key to ``never`` if you want to automatically accept all
                     """Read the projrc.confirm setting.
 
                     Valid values are:
-                    - True / always: Always ask for confirmation
-                    - first:         Ask for confirmation when the projrc file
-                                     is transferred for the first time
-                    - False / never: Do not ask for confirmation
-                                     (i.e. accept all projrc changes)
+                    - true: Always ask for confirmation
+                    - first: Ask for confirmation when the projrc file
+                             is transferred for the first time
+                    - false: Do not ask for confirmation
+                             (i.e. accept all projrc changes)
+
+                    Note that you can use any valid 'boolean' value
+                    instead of true and false (i.e. always, yes, on or 1
+                    instead of true and never, no, off or 0 instead of false)
                     """
                     confirmchanges = ui.config(
                         'projrc', 'confirm', default=True)
 
                     if isinstance(confirmchanges, bool):
                         return confirmchanges
+                    confirm = util.parsebool(confirmchanges)
+                    if not confirm is None:
+                        return confirm
                     confirmchanges = confirmchanges.lower()
-                    if confirmchanges in ("false", "never"):
-                        return False
-                    elif projrcexists and confirmchanges == "first":
+                    if projrcexists and confirmchanges == "first":
                         return False
                     return True
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.