Show More
@@ -2700,8 +2700,8 b' def debugdeltachain(ui, repo, file_=None' | |||||
2700 |
|
2700 | |||
2701 | fm.end() |
|
2701 | fm.end() | |
2702 |
|
2702 | |||
2703 | @command('debuginstall', [], '', norepo=True) |
|
2703 | @command('debuginstall', [] + formatteropts, '', norepo=True) | |
2704 | def debuginstall(ui): |
|
2704 | def debuginstall(ui, **opts): | |
2705 | '''test Mercurial installation |
|
2705 | '''test Mercurial installation | |
2706 |
|
2706 | |||
2707 | Returns 0 on success. |
|
2707 | Returns 0 on success. | |
@@ -2716,25 +2716,33 b' def debuginstall(ui):' | |||||
2716 |
|
2716 | |||
2717 | problems = 0 |
|
2717 | problems = 0 | |
2718 |
|
2718 | |||
|
2719 | fm = ui.formatter('debuginstall', opts) | |||
|
2720 | fm.startitem() | |||
|
2721 | ||||
2719 | # encoding |
|
2722 | # encoding | |
2720 |
|
|
2723 | fm.write('encoding', _("checking encoding (%s)...\n"), encoding.encoding) | |
|
2724 | err = None | |||
2721 | try: |
|
2725 | try: | |
2722 | encoding.fromlocal("test") |
|
2726 | encoding.fromlocal("test") | |
2723 | except error.Abort as inst: |
|
2727 | except error.Abort as inst: | |
2724 |
|
|
2728 | err = inst | |
2725 | ui.write(_(" (check that your locale is properly set)\n")) |
|
|||
2726 | problems += 1 |
|
2729 | problems += 1 | |
|
2730 | fm.condwrite(err, 'encodingerror', _(" %s\n" | |||
|
2731 | " (check that your locale is properly set)\n"), err) | |||
2727 |
|
2732 | |||
2728 | # Python |
|
2733 | # Python | |
2729 |
|
|
2734 | fm.write('pythonexe', _("checking Python executable (%s)\n"), | |
2730 | ui.status(_("checking Python version (%s)\n") |
|
2735 | sys.executable) | |
2731 | % ("%s.%s.%s" % sys.version_info[:3])) |
|
2736 | fm.write('pythonver', _("checking Python version (%s)\n"), | |
2732 | ui.status(_("checking Python lib (%s)...\n") |
|
2737 | ("%s.%s.%s" % sys.version_info[:3])) | |
2733 | % os.path.dirname(os.__file__)) |
|
2738 | fm.write('pythonlib', _("checking Python lib (%s)...\n"), | |
|
2739 | os.path.dirname(os.__file__)) | |||
2734 |
|
2740 | |||
2735 | # compiled modules |
|
2741 | # compiled modules | |
2736 |
|
|
2742 | fm.write('hgmodules', _("checking installed modules (%s)...\n"), | |
2737 |
|
|
2743 | os.path.dirname(__file__)) | |
|
2744 | ||||
|
2745 | err = None | |||
2738 | try: |
|
2746 | try: | |
2739 | from . import ( |
|
2747 | from . import ( | |
2740 | base85, |
|
2748 | base85, | |
@@ -2744,63 +2752,74 b' def debuginstall(ui):' | |||||
2744 | ) |
|
2752 | ) | |
2745 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes |
|
2753 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes | |
2746 | except Exception as inst: |
|
2754 | except Exception as inst: | |
2747 |
|
|
2755 | err = inst | |
2748 | ui.write(_(" One or more extensions could not be found")) |
|
|||
2749 | ui.write(_(" (check that you compiled the extensions)\n")) |
|
|||
2750 | problems += 1 |
|
2756 | problems += 1 | |
|
2757 | fm.condwrite(err, 'extensionserror', " %s\n", err) | |||
2751 |
|
2758 | |||
2752 | # templates |
|
2759 | # templates | |
2753 | from . import templater |
|
2760 | from . import templater | |
2754 | p = templater.templatepaths() |
|
2761 | p = templater.templatepaths() | |
2755 |
|
|
2762 | fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p)) | |
|
2763 | fm.condwrite(not p, '', _(" no template directories found\n")) | |||
2756 | if p: |
|
2764 | if p: | |
2757 | m = templater.templatepath("map-cmdline.default") |
|
2765 | m = templater.templatepath("map-cmdline.default") | |
2758 | if m: |
|
2766 | if m: | |
2759 | # template found, check if it is working |
|
2767 | # template found, check if it is working | |
|
2768 | err = None | |||
2760 | try: |
|
2769 | try: | |
2761 | templater.templater(m) |
|
2770 | templater.templater(m) | |
2762 | except Exception as inst: |
|
2771 | except Exception as inst: | |
2763 |
|
|
2772 | err = inst | |
2764 | p = None |
|
2773 | p = None | |
|
2774 | fm.condwrite(err, 'defaulttemplateerror', " %s\n", err) | |||
2765 | else: |
|
2775 | else: | |
2766 | ui.write(_(" template 'default' not found\n")) |
|
|||
2767 | p = None |
|
2776 | p = None | |
2768 | else: |
|
2777 | fm.condwrite(p, 'defaulttemplate', | |
2769 | ui.write(_(" no template directories found\n")) |
|
2778 | _("checking default template (%s)\n"), m) | |
|
2779 | fm.condwrite(not m, 'defaulttemplatenotfound', | |||
|
2780 | _(" template '%s' not found\n"), "default") | |||
2770 | if not p: |
|
2781 | if not p: | |
2771 | ui.write(_(" (templates seem to have been installed incorrectly)\n")) |
|
|||
2772 | problems += 1 |
|
2782 | problems += 1 | |
|
2783 | fm.condwrite(not p, '', | |||
|
2784 | _(" (templates seem to have been installed incorrectly)\n")) | |||
2773 |
|
2785 | |||
2774 | # editor |
|
2786 | # editor | |
2775 | ui.status(_("checking commit editor...\n")) |
|
|||
2776 | editor = ui.geteditor() |
|
2787 | editor = ui.geteditor() | |
2777 | editor = util.expandpath(editor) |
|
2788 | editor = util.expandpath(editor) | |
|
2789 | fm.write('editor', _("checking commit editor... (%s)\n"), editor) | |||
2778 | cmdpath = util.findexe(shlex.split(editor)[0]) |
|
2790 | cmdpath = util.findexe(shlex.split(editor)[0]) | |
2779 | if not cmdpath: |
|
2791 | fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', | |
2780 | if editor == 'vi': |
|
2792 | _(" No commit editor set and can't find %s in PATH\n" | |
2781 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
|
2793 | " (specify a commit editor in your configuration" | |
2782 | ui.write(_(" (specify a commit editor in your configuration" |
|
2794 | " file)\n"), not cmdpath and editor == 'vi' and editor) | |
2783 | " file)\n")) |
|
2795 | fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound', | |
2784 | else: |
|
2796 | _(" Can't find editor '%s' in PATH\n" | |
2785 | ui.write(_(" Can't find editor '%s' in PATH\n") % editor) |
|
2797 | " (specify a commit editor in your configuration" | |
2786 | ui.write(_(" (specify a commit editor in your configuration" |
|
2798 | " file)\n"), not cmdpath and editor) | |
2787 | " file)\n")) |
|
2799 | if not cmdpath and editor != 'vi': | |
2788 |
|
|
2800 | problems += 1 | |
2789 |
|
2801 | |||
2790 | # check username |
|
2802 | # check username | |
2791 | ui.status(_("checking username...\n")) |
|
2803 | username = None | |
|
2804 | err = None | |||
2792 | try: |
|
2805 | try: | |
2793 | ui.username() |
|
2806 | username = ui.username() | |
2794 | except error.Abort as e: |
|
2807 | except error.Abort as e: | |
2795 | ui.write(" %s\n" % e) |
|
2808 | err = e | |
2796 | ui.write(_(" (specify a username in your configuration file)\n")) |
|
|||
2797 | problems += 1 |
|
2809 | problems += 1 | |
2798 |
|
2810 | |||
|
2811 | fm.condwrite(username, 'username', _("checking username (%s)\n"), username) | |||
|
2812 | fm.condwrite(err, 'usernameerror', _("checking username...\n %s\n" | |||
|
2813 | " (specify a username in your configuration file)\n"), err) | |||
|
2814 | ||||
|
2815 | fm.condwrite(not problems, '', | |||
|
2816 | _("no problems detected\n")) | |||
2799 | if not problems: |
|
2817 | if not problems: | |
2800 | ui.status(_("no problems detected\n")) |
|
2818 | fm.data(problems=problems) | |
2801 | else: |
|
2819 | fm.condwrite(problems, 'problems', | |
2802 |
|
|
2820 | _("%s problems detected," | |
2803 |
" please check your install!\n") |
|
2821 | " please check your install!\n"), problems) | |
|
2822 | fm.end() | |||
2804 |
|
2823 | |||
2805 | return problems |
|
2824 | return problems | |
2806 |
|
2825 |
@@ -254,7 +254,7 b' Show all commands + options' | |||||
254 | debugignore: |
|
254 | debugignore: | |
255 | debugindex: changelog, manifest, dir, format |
|
255 | debugindex: changelog, manifest, dir, format | |
256 | debugindexdot: changelog, manifest, dir |
|
256 | debugindexdot: changelog, manifest, dir | |
257 | debuginstall: |
|
257 | debuginstall: template | |
258 | debugknown: |
|
258 | debugknown: | |
259 | debuglabelcomplete: |
|
259 | debuglabelcomplete: | |
260 | debuglocks: force-lock, force-wlock |
|
260 | debuglocks: force-lock, force-wlock |
@@ -6,10 +6,35 b' hg debuginstall' | |||||
6 | checking Python lib (*lib*)... (glob) |
|
6 | checking Python lib (*lib*)... (glob) | |
7 | checking installed modules (*mercurial)... (glob) |
|
7 | checking installed modules (*mercurial)... (glob) | |
8 | checking templates (*mercurial?templates)... (glob) |
|
8 | checking templates (*mercurial?templates)... (glob) | |
9 | checking commit editor... |
|
9 | checking default template (*mercurial?templates?map-cmdline.default) (glob) | |
10 | checking username... |
|
10 | checking commit editor... (*python* -c "import sys; sys.exit(0)") (glob) | |
|
11 | checking username (test) | |||
11 | no problems detected |
|
12 | no problems detected | |
12 |
|
13 | |||
|
14 | hg debuginstall JSON | |||
|
15 | $ hg debuginstall -Tjson | |||
|
16 | [ | |||
|
17 | { | |||
|
18 | "defaulttemplate": "*mercurial?templates?map-cmdline.default", (glob) | |||
|
19 | "defaulttemplateerror": null, | |||
|
20 | "defaulttemplatenotfound": "default", | |||
|
21 | "editor": "*python* -c \"import sys; sys.exit(0)\"", (glob) | |||
|
22 | "editornotfound": false, | |||
|
23 | "encoding": "ascii", | |||
|
24 | "encodingerror": null, | |||
|
25 | "extensionserror": null, | |||
|
26 | "hgmodules": "*mercurial", (glob) | |||
|
27 | "problems": 0, | |||
|
28 | "pythonexe": "*python", (glob) | |||
|
29 | "pythonlib": "*python*", (glob) | |||
|
30 | "pythonver": "*.*.*", (glob) | |||
|
31 | "templatedirs": "*mercurial?templates", (glob) | |||
|
32 | "username": "test", | |||
|
33 | "usernameerror": null, | |||
|
34 | "vinotfound": false | |||
|
35 | } | |||
|
36 | ] | |||
|
37 | ||||
13 | hg debuginstall with no username |
|
38 | hg debuginstall with no username | |
14 | $ HGUSER= hg debuginstall |
|
39 | $ HGUSER= hg debuginstall | |
15 | checking encoding (ascii)... |
|
40 | checking encoding (ascii)... | |
@@ -18,7 +43,8 b' hg debuginstall with no username' | |||||
18 | checking Python lib (*lib*)... (glob) |
|
43 | checking Python lib (*lib*)... (glob) | |
19 | checking installed modules (*mercurial)... (glob) |
|
44 | checking installed modules (*mercurial)... (glob) | |
20 | checking templates (*mercurial?templates)... (glob) |
|
45 | checking templates (*mercurial?templates)... (glob) | |
21 | checking commit editor... |
|
46 | checking default template (*mercurial?templates?map-cmdline.default) (glob) | |
|
47 | checking commit editor... (*python* -c "import sys; sys.exit(0)") (glob) | |||
22 | checking username... |
|
48 | checking username... | |
23 | no username supplied |
|
49 | no username supplied | |
24 | (specify a username in your configuration file) |
|
50 | (specify a username in your configuration file) | |
@@ -38,8 +64,9 b' path variables are expanded (~ is the sa' | |||||
38 | checking Python lib (*lib*)... (glob) |
|
64 | checking Python lib (*lib*)... (glob) | |
39 | checking installed modules (*mercurial)... (glob) |
|
65 | checking installed modules (*mercurial)... (glob) | |
40 | checking templates (*mercurial?templates)... (glob) |
|
66 | checking templates (*mercurial?templates)... (glob) | |
41 | checking commit editor... |
|
67 | checking default template (*mercurial?templates?map-cmdline.default) (glob) | |
42 | checking username... |
|
68 | checking commit editor... (*python* -c "import sys; sys.exit(0)") (glob) | |
|
69 | checking username (test) | |||
43 | no problems detected |
|
70 | no problems detected | |
44 |
|
71 | |||
45 | #if test-repo |
|
72 | #if test-repo |
General Comments 0
You need to be logged in to leave comments.
Login now