##// END OF EJS Templates
Add debuginstall command to do basic install tests
Matt Mackall -
r3844:3ba82c3f default
parent child Browse files
Show More
@@ -0,0 +1,3 b''
1 #!/bin/sh
2
3 hg debuginstall
@@ -0,0 +1,7 b''
1 Checking encoding (ascii)...
2 Checking extensions...
3 Checking templates...
4 Checking patch...
5 Checking merge helper...
6 Checking commit editor...
7 No problems detected
@@ -827,6 +827,87 b' def debugindexdot(ui, file_):'
827 827 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
828 828 ui.write("}\n")
829 829
830 def debuginstall(ui):
831 '''test Mercurial installation'''
832
833 problems = 0
834
835 # encoding
836 ui.status(_("Checking encoding (%s)...\n") % util._encoding)
837 try:
838 util.fromlocal("test")
839 except util.Abort, inst:
840 ui.write(" %s\n" % inst)
841 problems += 1
842
843 # compiled modules
844 ui.status(_("Checking extensions...\n"))
845 try:
846 import bdiff, mpatch, base85
847 except Exception, inst:
848 ui.write(" %s\n" % inst)
849 ui.write(_(" One or more extensions could not be found,"
850 " check your build.\n"))
851 problems += 1
852
853 # templates
854 ui.status(_("Checking templates...\n"))
855 try:
856 import templater
857 t = templater.templater(templater.templatepath("map-cmdline.default"))
858 except Exception, inst:
859 ui.write(" %s\n" % inst)
860 problems += 1
861
862 # patch
863 ui.status(_("Checking patch...\n"))
864 path = os.environ.get('PATH', '')
865 patcher = util.find_in_path('gpatch', path,
866 util.find_in_path('patch', path, None))
867 if not patcher:
868 ui.write(_(" Can't find patch or gpatch in PATH\n"))
869 problems += 1
870 # should actually attempt a patch here
871
872 # merge helper
873 ui.status(_("Checking merge helper...\n"))
874 cmd = (os.environ.get("HGMERGE") or ui.config("ui", "merge")
875 or "hgmerge")
876 cmdpath = util.find_in_path(cmd, path)
877 if not cmdpath:
878 cmdpath = util.find_in_path(cmd.split()[0], path)
879 if not cmdpath:
880 if cmd == 'hgmerge':
881 ui.write(_(" No merge helper set and can't find default"
882 " hgmerge script in PATH\n"))
883 else:
884 ui.write(_(" Can't find merge helper '%s' in PATH\n") % cmd)
885 problems += 1
886 # should attempt a non-conflicting merge here
887
888 # editor
889 ui.status(_("Checking commit editor...\n"))
890 editor = (os.environ.get("HGEDITOR") or
891 ui.config("ui", "editor") or
892 os.environ.get("EDITOR", "vi"))
893 cmdpath = util.find_in_path(editor, path)
894 if not cmdpath:
895 cmdpath = util.find_in_path(editor.split()[0], path)
896 if not cmdpath:
897 if cmd == 'vi':
898 ui.write(_(" No commit editor set and can't find vi in PATH\n"))
899 else:
900 ui.write(_(" Can't find editor '%s' in PATH\n") % editor)
901 problems += 1
902
903 if not problems:
904 ui.status(_("No problems detected\n"))
905 else:
906 ui.write(_("%s problems detected,"
907 " please check your install!\n") % problems)
908
909 return problems
910
830 911 def debugrename(ui, repo, file1, *pats, **opts):
831 912 """dump rename information"""
832 913
@@ -2524,6 +2605,7 b' table = {'
2524 2605 (debugcomplete,
2525 2606 [('o', 'options', None, _('show the command options'))],
2526 2607 _('debugcomplete [-o] CMD')),
2608 "debuginstall": (debuginstall, [], _('debuginstall')),
2527 2609 "debugrebuildstate":
2528 2610 (debugrebuildstate,
2529 2611 [('r', 'rev', '', _('revision to rebuild to'))],
@@ -2787,7 +2869,7 b' table = {'
2787 2869 }
2788 2870
2789 2871 norepo = ("clone init version help debugancestor debugcomplete debugdata"
2790 " debugindex debugindexdot debugdate")
2872 " debugindex debugindexdot debugdate debuginstall")
2791 2873 optionalrepo = ("paths serve showconfig")
2792 2874
2793 2875 def findpossible(ui, cmd):
@@ -64,6 +64,7 b' debugdata'
64 64 debugdate
65 65 debugindex
66 66 debugindexdot
67 debuginstall
67 68 debugrawcommit
68 69 debugrebuildstate
69 70 debugrename
General Comments 0
You need to be logged in to leave comments. Login now