# HG changeset patch # User Brendan Cully # Date 1177776227 25200 # Node ID 28054fc34923da1f76ae2b375d763a26deba4935 # Parent 8c2a18cc3096dd300d196c2b960e8e91fbf6791a# Parent e89f9afc462b40b0bc673aa82e661c54a2b48af8 Merge with crew diff -r e89f9afc462b -r 28054fc34923 mercurial/commands.py --- a/mercurial/commands.py Fri Apr 27 21:30:55 2007 -0700 +++ b/mercurial/commands.py Sat Apr 28 09:03:47 2007 -0700 @@ -1550,7 +1550,7 @@ p2 = repo.lookup(p2) if p1 == wp[0].node(): repo.dirstate.setparents(p1, p2) - except RepoError: + except hg.RepoError: pass files = {} diff -r e89f9afc462b -r 28054fc34923 mercurial/util_win32.py --- a/mercurial/util_win32.py Fri Apr 27 21:30:55 2007 -0700 +++ b/mercurial/util_win32.py Sat Apr 28 09:03:47 2007 -0700 @@ -297,5 +297,30 @@ win32file.SetEndOfFile(self.handle) except pywintypes.error, err: raise WinIOError(err) + +def find_in_path(name, path, default=None): + '''find name in search path. path can be string (will be split + with os.pathsep), or iterable thing that returns strings. if name + found, return path to name. else return default. name is looked up + using cmd.exe rules, using PATHEXT.''' + if isinstance(path, str): + path = path.split(os.pathsep) + + pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD') + pathext = pathext.lower().split(os.pathsep) + isexec = os.path.splitext(name)[1].lower() in pathext + + for p in path: + p_name = os.path.join(p, name) + + if isexec and os.path.exists(p_name): + return p_name + + for ext in pathext: + p_name_ext = p_name + ext + if os.path.exists(p_name_ext): + return p_name_ext + + return default getuser_fallback = win32api.GetUserName