824 pp = r.parents(node) |
824 pp = r.parents(node) |
825 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
825 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
826 if pp[1] != nullid: |
826 if pp[1] != nullid: |
827 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
827 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
828 ui.write("}\n") |
828 ui.write("}\n") |
|
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 |
829 |
910 |
830 def debugrename(ui, repo, file1, *pats, **opts): |
911 def debugrename(ui, repo, file1, *pats, **opts): |
831 """dump rename information""" |
912 """dump rename information""" |
832 |
913 |
833 ctx = repo.changectx(opts.get('rev', 'tip')) |
914 ctx = repo.changectx(opts.get('rev', 'tip')) |
2522 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
2603 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
2523 "debugcomplete": |
2604 "debugcomplete": |
2524 (debugcomplete, |
2605 (debugcomplete, |
2525 [('o', 'options', None, _('show the command options'))], |
2606 [('o', 'options', None, _('show the command options'))], |
2526 _('debugcomplete [-o] CMD')), |
2607 _('debugcomplete [-o] CMD')), |
|
2608 "debuginstall": (debuginstall, [], _('debuginstall')), |
2527 "debugrebuildstate": |
2609 "debugrebuildstate": |
2528 (debugrebuildstate, |
2610 (debugrebuildstate, |
2529 [('r', 'rev', '', _('revision to rebuild to'))], |
2611 [('r', 'rev', '', _('revision to rebuild to'))], |
2530 _('debugrebuildstate [-r REV] [REV]')), |
2612 _('debugrebuildstate [-r REV] [REV]')), |
2531 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
2613 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
2785 "verify": (verify, [], _('hg verify')), |
2867 "verify": (verify, [], _('hg verify')), |
2786 "version": (version_, [], _('hg version')), |
2868 "version": (version_, [], _('hg version')), |
2787 } |
2869 } |
2788 |
2870 |
2789 norepo = ("clone init version help debugancestor debugcomplete debugdata" |
2871 norepo = ("clone init version help debugancestor debugcomplete debugdata" |
2790 " debugindex debugindexdot debugdate") |
2872 " debugindex debugindexdot debugdate debuginstall") |
2791 optionalrepo = ("paths serve showconfig") |
2873 optionalrepo = ("paths serve showconfig") |
2792 |
2874 |
2793 def findpossible(ui, cmd): |
2875 def findpossible(ui, cmd): |
2794 """ |
2876 """ |
2795 Return cmd -> (aliases, command table entry) |
2877 Return cmd -> (aliases, command table entry) |