<div dir="ltr"><div>Hello Prasoon,<br><br>Sorry for the late reply to your patch.<br><br>On Sat, Jan 11, 2014 at 10:24 AM, Prasoon Shukla <<a href="mailto:prasoon92.iitr@gmail.com">prasoon92.iitr@gmail.com</a>> wrote:<br>
><br>> Version 2 of patch for issue 4141. Tests have not been added because<br>> there is not support for multiline matching. The problems mentioned<br>> by Matt have been fixed. Please see this thread for details:<br>
> <a href="http://mercurial.808500.n3.nabble.com/PATCH-debuginstall-display-warning-when-multiple-installs-are-present-issue4141-td4006273.html">http://mercurial.808500.n3.nabble.com/PATCH-debuginstall-display-warning-when-multiple-installs-are-present-issue4141-td4006273.html</a><br>
><br><br>Uhm, you added some text on the top of the patch.<br>Here we usually send patches in the body of emails,<br>but we don't compose them by hand: we use the patchbomb extension<br>to send the emails automatically.<br>
Are you using patchbomb too?<br>If not, I encourage you to, it's the safest way:<br><a href="http://mercurial.selenic.com/wiki/ContributingChanges#Emailing_patches">http://mercurial.selenic.com/wiki/ContributingChanges#Emailing_patches</a><br>
<br>I guess that adding text not related to the patch also complicates<br>the job of the mantainers who apply them to their repo.<br><br>> # HG changeset patch<br>> # User Prasoon Shukla <<a href="mailto:prasoon92.iitr@gmail.com">prasoon92.iitr@gmail.com</a>><br>
> # Date 1389431301 -19800<br>> # Node ID 5d9942f43bee3e6c04c24cba24b340be5d7ab6cc<br>> # Parent  d2704c48f4176d8cd6f21d33500820d44763585c<br>> debuginstall: display warning when multiple installs are present (issue4141)<br>
><br>> If multiple installations of hg are present, a warning is displayed along<br>> with all the installs.<br>><br>> diff -r d2704c48f417 -r 5d9942f43bee mercurial/commands.py<br>> --- a/mercurial/commands.py Fri Nov 15 23:28:43 2013 -0500<br>
> +++ b/mercurial/commands.py Sat Jan 11 14:38:21 2014 +0530<br>> @@ -8,7 +8,7 @@<br>>  from node import hex, bin, nullid, nullrev, short<br>>  from lock import release<br>>  from i18n import _<br>> -import os, re, difflib, time, tempfile, errno<br>
> +import os, sys, re, difflib, time, tempfile, errno<br>>  import hg, scmutil, util, revlog, copies, error, bookmarks<br>>  import patch, help, encoding, templatekw, discovery<br>>  import archival, changegroup, cmdutil, hbisect<br>
> @@ -2047,6 +2047,16 @@<br>>  <br>>      problems = 0<br>>  <br>> +    # installations<br>> +    installs = util.findhgexe()<br>> +    if not installs:<br>> +        ui.warn(_("warning! no file named hg found in path"))<br>
> +    else:<br>> +        ui.status(_("checking hg path (%s)...\n" % sys.argv[0]))<br>> +        if len(installs) > 1:<br>> +            ui.warn(_("warning! multiple installs of hg detected:\n  %s...\n"<br>
> +                      % '\n  '.join(installs)))<br>> +<br>>      # encoding<br>>      ui.status(_("checking encoding (%s)...\n") % encoding.encoding)<br>>      try:<br>> diff -r d2704c48f417 -r 5d9942f43bee mercurial/util.py<br>
> --- a/mercurial/util.py Fri Nov 15 23:28:43 2013 -0500<br>> +++ b/mercurial/util.py Sat Jan 11 14:38:21 2014 +0530<br>> @@ -14,7 +14,7 @@<br>>  """<br>>  <br>>  from i18n import _<br>> -import error, osutil, encoding<br>
> +import error, osutil, encoding, glob<br>>  import errno, re, shutil, sys, tempfile, traceback<br>>  import os, time, datetime, calendar, textwrap, signal, collections<br>>  import imp, socket, urllib<br>> @@ -1983,3 +1983,27 @@<br>
>          self._hooks.sort(key=lambda x: x[0])<br>>          for source, hook in self._hooks:<br>>              hook(*args)<br>> +<br>> +def findhgexe(path=None):<br>> +    '''Find all executables containing `hg` in `path`.'''<br>
> +<br>> +    matches = []<br>> +<br>> +    if (sys.platform == 'win32' or <a href="http://os.name">os.name</a> == 'os2'):<br>> +        exe = 'hg*.exe'<br>> +    else:<br>> +        exe = 'hg*'<br>
<br>First off, note that I am totally incompetent on this matter.<br>But I have seen this patch sadly rottening here in the archives,<br>so I asked on IRC if somebody could comment.<br><br>Here I report verbatim what I got from Henrik Stuart.<br>
If you want to discuss with him, look for hstuart on #mercurial (freenode).<br><br>--------------------------<br>hg can easily be started as hg.bat or hg.cmd<br>or any other variation of it; Windows contains<br>an environment variable, PATHEXT, that controls what<br>
possible suffixes you can use<br>(honestly, I can't recall what OS/2 uses),<br>but that patch, as is, is not good enough [...].<br><br>also, usually, we move these os-specific things<br>into the respective files, which he has failed to do.<br>
<br>and if it's to detect multiple installs of hg, I don't see<br>why he searches for hg*<br>(I think he took away the wrong message from Matt;<br>it's not that he should search for hg*, it's that he should<br>
use for a command with the same name as the one that was started)<br>--------------------------<br><br>This is it.<br></div>Can you please ponder these suggestions?<br><div><br>Cheers,<br>GGhh<br><br>> +<br>> +    if path is None:<br>
> +        path = os.environ['PATH']<br>> +    paths = path.split(os.pathsep)<br>> +<br>> +    for p in paths:<br>> +        matchstr = p + '/' + exe<br>> +        allexes = [f for f in glob.glob(matchstr) if<br>
> +                   all(['ssh' not in f, 'web' not in f, 'editor' not in f])]<br>> +        for f in allexes:<br>> +            if os.path.isfile(f):<br>> +                matches.append(f)<br>
> +<br>> +    return matches<br>><br>> _______________________________________________<br>> Mercurial-devel mailing list<br>> <a href="mailto:Mercurial-devel@selenic.com">Mercurial-devel@selenic.com</a><br>
> <a href="http://selenic.com/mailman/listinfo/mercurial-devel">http://selenic.com/mailman/listinfo/mercurial-devel</a><br>><br><br></div></div>