##// END OF EJS Templates
Add some remedies and a username check to debuginstall
Matt Mackall -
r3848:8cbf060f default
parent child Browse files
Show More
@@ -845,6 +845,7 b' def debuginstall(ui):'
845 util.fromlocal("test")
845 util.fromlocal("test")
846 except util.Abort, inst:
846 except util.Abort, inst:
847 ui.write(" %s\n" % inst)
847 ui.write(" %s\n" % inst)
848 ui.write(_(" (check that your locale is properly set)\n"))
848 problems += 1
849 problems += 1
849
850
850 # compiled modules
851 # compiled modules
@@ -853,8 +854,8 b' def debuginstall(ui):'
853 import bdiff, mpatch, base85
854 import bdiff, mpatch, base85
854 except Exception, inst:
855 except Exception, inst:
855 ui.write(" %s\n" % inst)
856 ui.write(" %s\n" % inst)
856 ui.write(_(" One or more extensions could not be found,"
857 ui.write(_(" One or more extensions could not be found"))
857 " check your build.\n"))
858 ui.write(_(" (check that you compiled the extensions)\n"))
858 problems += 1
859 problems += 1
859
860
860 # templates
861 # templates
@@ -864,6 +865,7 b' def debuginstall(ui):'
864 t = templater.templater(templater.templatepath("map-cmdline.default"))
865 t = templater.templater(templater.templatepath("map-cmdline.default"))
865 except Exception, inst:
866 except Exception, inst:
866 ui.write(" %s\n" % inst)
867 ui.write(" %s\n" % inst)
868 ui.write(_(" (templates seem to have been installed incorrectly)\n"))
867 problems += 1
869 problems += 1
868
870
869 # patch
871 # patch
@@ -873,6 +875,7 b' def debuginstall(ui):'
873 util.find_in_path('patch', path, None))
875 util.find_in_path('patch', path, None))
874 if not patcher:
876 if not patcher:
875 ui.write(_(" Can't find patch or gpatch in PATH\n"))
877 ui.write(_(" Can't find patch or gpatch in PATH\n"))
878 ui.write(_(" (specify a patch utility in your .hgrc file)\n"))
876 problems += 1
879 problems += 1
877 else:
880 else:
878 # actually attempt a patch here
881 # actually attempt a patch here
@@ -891,11 +894,13 b' def debuginstall(ui):'
891 files.append(pf)
894 files.append(pf)
892 if files != [fa]:
895 if files != [fa]:
893 ui.write(_(" unexpected patch output!"))
896 ui.write(_(" unexpected patch output!"))
897 ui.write(_(" (you may have an incompatible version of patch)\n"))
894 ui.write(data)
898 ui.write(data)
895 problems += 1
899 problems += 1
896 a = file(fa).read()
900 a = file(fa).read()
897 if a != b:
901 if a != b:
898 ui.write(_(" patch test failed!"))
902 ui.write(_(" patch test failed!"))
903 ui.write(_(" (you may have an incompatible version of patch)\n"))
899 problems += 1
904 problems += 1
900 os.unlink(fa)
905 os.unlink(fa)
901 os.unlink(fd)
906 os.unlink(fd)
@@ -911,8 +916,10 b' def debuginstall(ui):'
911 if cmd == 'hgmerge':
916 if cmd == 'hgmerge':
912 ui.write(_(" No merge helper set and can't find default"
917 ui.write(_(" No merge helper set and can't find default"
913 " hgmerge script in PATH\n"))
918 " hgmerge script in PATH\n"))
919 ui.write(_(" (specify a merge helper in your .hgrc file)\n"))
914 else:
920 else:
915 ui.write(_(" Can't find merge helper '%s' in PATH\n") % cmd)
921 ui.write(_(" Can't find merge helper '%s' in PATH\n") % cmd)
922 ui.write(_(" (specify a merge helper in your .hgrc file)\n"))
916 problems += 1
923 problems += 1
917 else:
924 else:
918 # actually attempt a patch here
925 # actually attempt a patch here
@@ -926,6 +933,8 b' def debuginstall(ui):'
926 m = file(fl).read()
933 m = file(fl).read()
927 if m != "begin\n1\n2\n3\ninsert\n4\n":
934 if m != "begin\n1\n2\n3\ninsert\n4\n":
928 ui.write(_(" got unexpected merge results!") % r)
935 ui.write(_(" got unexpected merge results!") % r)
936 ui.write(_(" (your merge helper may have the"
937 " wrong argument order)\n"))
929 ui.write(m)
938 ui.write(m)
930 os.unlink(fa)
939 os.unlink(fa)
931 os.unlink(fl)
940 os.unlink(fl)
@@ -942,10 +951,24 b' def debuginstall(ui):'
942 if not cmdpath:
951 if not cmdpath:
943 if cmd == 'vi':
952 if cmd == 'vi':
944 ui.write(_(" No commit editor set and can't find vi in PATH\n"))
953 ui.write(_(" No commit editor set and can't find vi in PATH\n"))
954 ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
945 else:
955 else:
946 ui.write(_(" Can't find editor '%s' in PATH\n") % editor)
956 ui.write(_(" Can't find editor '%s' in PATH\n") % editor)
957 ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
947 problems += 1
958 problems += 1
948
959
960 # check username
961 ui.status(_("Checking username...\n"))
962 user = os.environ.get("HGUSER")
963 if user is None:
964 user = ui.config("ui", "username")
965 if user is None:
966 user = os.environ.get("EMAIL")
967 if not user:
968 ui.warn(" ")
969 ui.username()
970 ui.write(_(" (specify a username in your .hgrc file)\n"))
971
949 if not problems:
972 if not problems:
950 ui.status(_("No problems detected\n"))
973 ui.status(_("No problems detected\n"))
951 else:
974 else:
@@ -4,4 +4,5 b' Checking templates...'
4 Checking patch...
4 Checking patch...
5 Checking merge helper...
5 Checking merge helper...
6 Checking commit editor...
6 Checking commit editor...
7 Checking username...
7 No problems detected
8 No problems detected
General Comments 0
You need to be logged in to leave comments. Login now