Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 2410:1e80d47b8581
debugconfig: allow to print by section and exact item name
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Thu, 08 Jun 2006 11:28:27 -0700 |
parents | 8fe3d60b7f19 |
children | 734df6333ca4 |
comparison
equal
deleted
inserted
replaced
2409:4068d6a7a99e | 2410:1e80d47b8581 |
---|---|
1269 errors += 1 | 1269 errors += 1 |
1270 if errors: | 1270 if errors: |
1271 error = _(".hg/dirstate inconsistent with current parent's manifest") | 1271 error = _(".hg/dirstate inconsistent with current parent's manifest") |
1272 raise util.Abort(error) | 1272 raise util.Abort(error) |
1273 | 1273 |
1274 def debugconfig(ui, repo): | 1274 def debugconfig(ui, repo, *values): |
1275 """show combined config settings from all hgrc files""" | 1275 """show combined config settings from all hgrc files |
1276 | |
1277 With no args, print names and values of all config items. | |
1278 | |
1279 With one arg of the form section.name, print just the value of | |
1280 that config item. | |
1281 | |
1282 With multiple args, print names and values of all config items | |
1283 with matching section names.""" | |
1284 | |
1285 if values: | |
1286 if len([v for v in values if '.' in v]) > 1: | |
1287 raise util.Abort(_('only one config item permitted')) | |
1276 for section, name, value in ui.walkconfig(): | 1288 for section, name, value in ui.walkconfig(): |
1277 ui.write('%s.%s=%s\n' % (section, name, value)) | 1289 sectname = section + '.' + name |
1290 if values: | |
1291 for v in values: | |
1292 if v == section: | |
1293 ui.write('%s=%s\n' % (sectname, value)) | |
1294 elif v == sectname: | |
1295 ui.write(value, '\n') | |
1296 else: | |
1297 ui.write('%s=%s\n' % (sectname, value)) | |
1278 | 1298 |
1279 def debugsetparents(ui, repo, rev1, rev2=None): | 1299 def debugsetparents(ui, repo, rev1, rev2=None): |
1280 """manually set the parents of the current working directory | 1300 """manually set the parents of the current working directory |
1281 | 1301 |
1282 This is useful for writing repository conversion tools, but should | 1302 This is useful for writing repository conversion tools, but should |
2868 "debugrebuildstate": | 2888 "debugrebuildstate": |
2869 (debugrebuildstate, | 2889 (debugrebuildstate, |
2870 [('r', 'rev', '', _('revision to rebuild to'))], | 2890 [('r', 'rev', '', _('revision to rebuild to'))], |
2871 _('debugrebuildstate [-r REV] [REV]')), | 2891 _('debugrebuildstate [-r REV] [REV]')), |
2872 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), | 2892 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
2873 "debugconfig": (debugconfig, [], _('debugconfig')), | 2893 "debugconfig": (debugconfig, [], _('debugconfig [NAME]...')), |
2874 "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), | 2894 "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), |
2875 "debugstate": (debugstate, [], _('debugstate')), | 2895 "debugstate": (debugstate, [], _('debugstate')), |
2876 "debugdata": (debugdata, [], _('debugdata FILE REV')), | 2896 "debugdata": (debugdata, [], _('debugdata FILE REV')), |
2877 "debugindex": (debugindex, [], _('debugindex FILE')), | 2897 "debugindex": (debugindex, [], _('debugindex FILE')), |
2878 "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), | 2898 "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), |