Mercurial > hg-stable
changeset 4389:6186b6cba8ea
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 29 Apr 2007 12:33:24 -0500 |
parents | 80c7fa620a4d (current diff) f9cd48bd8625 (diff) |
children | 052062b98f26 |
files | |
diffstat | 13 files changed, 133 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/win32/ReadMe.html Thu Apr 26 18:41:18 2007 -0500 +++ b/contrib/win32/ReadMe.html Sun Apr 29 12:33:24 2007 -0500 @@ -46,14 +46,21 @@ other Mercurial commands should work fine for you.</p> <h1>Configuration notes</h1> - <p>The default editor for commit messages is 'notepad'. You can set the EDITOR + <h4>Default editor</h4> + The default editor for commit messages is 'notepad'. You can set the EDITOR (or HGEDITOR) environment variable to specify your preference or set it in - mercurial.ini:</p> + mercurial.ini: <pre> [ui] editor = whatever </pre> + <h4>Configuring a Merge program</h4> + It should be emphasized that Mercurial by itself doesn't attempt to do a + Merge at the file level, neither does it make any attempt to Resolve the conflicts. + + By default, Mercurial will use the merge program defined by the HGMERGE environment + variable, or uses the one defined in the mercurial.ini file. (see <a href="http://www.selenic.com/mercurial/wiki/index.cgi/MergeProgram">MergeProgram</a> on the Mercurial Wiki for more information) <h1>Reporting problems</h1>
--- a/contrib/win32/mercurial.iss Thu Apr 26 18:41:18 2007 -0500 +++ b/contrib/win32/mercurial.iss Sun Apr 29 12:33:24 2007 -0500 @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! [Setup] -AppCopyright=Copyright 2005, 2006 Matt Mackall and others +AppCopyright=Copyright 2005-2007 Matt Mackall and others AppName=Mercurial AppVerName=Mercurial snapshot InfoAfterFile=contrib/win32/postinstall.txt @@ -18,7 +18,7 @@ DefaultDirName={sd}\Mercurial SourceDir=C:\hg\hg-release VersionInfoDescription=Mercurial distributed SCM -VersionInfoCopyright=Copyright 2005, 2006 Matt Mackall and others +VersionInfoCopyright=Copyright 2005-2007 Matt Mackall and others VersionInfoCompany=Matt Mackall and others InternalCompressLevel=max SolidCompression=true
--- a/mercurial/cmdutil.py Thu Apr 26 18:41:18 2007 -0500 +++ b/mercurial/cmdutil.py Sun Apr 29 12:33:24 2007 -0500 @@ -200,6 +200,50 @@ if not dry_run: repo.copy(old, new, wlock=wlock) +def service(opts, parentfn=None, initfn=None, runfn=None): + '''Run a command as a service.''' + + if opts['daemon'] and not opts['daemon_pipefds']: + rfd, wfd = os.pipe() + args = sys.argv[:] + args.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) + pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), + args[0], args) + os.close(wfd) + os.read(rfd, 1) + if parentfn: + return parentfn(pid) + else: + os._exit(0) + + if initfn: + initfn() + + if opts['pid_file']: + fp = open(opts['pid_file'], 'w') + fp.write(str(os.getpid()) + '\n') + fp.close() + + if opts['daemon_pipefds']: + rfd, wfd = [int(x) for x in opts['daemon_pipefds'].split(',')] + os.close(rfd) + try: + os.setsid() + except AttributeError: + pass + os.write(wfd, 'y') + os.close(wfd) + sys.stdout.flush() + sys.stderr.flush() + fd = os.open(util.nulldev, os.O_RDWR) + if fd != 0: os.dup2(fd, 0) + if fd != 1: os.dup2(fd, 1) + if fd != 2: os.dup2(fd, 2) + if fd not in (0, 1, 2): os.close(fd) + + if runfn: + return runfn() + class changeset_printer(object): '''show changeset information when templating not requested.'''
--- a/mercurial/commands.py Thu Apr 26 18:41:18 2007 -0500 +++ b/mercurial/commands.py Sun Apr 29 12:33:24 2007 -0500 @@ -891,27 +891,28 @@ # actually attempt a patch here a = "1\n2\n3\n4\n" b = "1\n2\n3\ninsert\n4\n" - d = mdiff.unidiff(a, None, b, None, "a") fa = writetemp(a) + d = mdiff.unidiff(a, None, b, None, os.path.basename(fa)) fd = writetemp(d) - fp = os.popen('%s %s %s' % (patcher, fa, fd)) - files = [] - output = "" - for line in fp: - output += line - if line.startswith('patching file '): - pf = util.parse_patch_output(line.rstrip()) - files.append(pf) - if files != [fa]: - ui.write(_(" unexpected patch output!")) - ui.write(_(" (you may have an incompatible version of patch)\n")) - ui.write(output) + + files = {} + try: + patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files) + except util.Abort, e: + ui.write(_(" patch call failed:\n")) + ui.write(" " + str(e) + "\n") problems += 1 - a = file(fa).read() - if a != b: - ui.write(_(" patch test failed!")) - ui.write(_(" (you may have an incompatible version of patch)\n")) - problems += 1 + else: + if list(files) != [os.path.basename(fa)]: + ui.write(_(" unexpected patch output!")) + ui.write(_(" (you may have an incompatible version of patch)\n")) + problems += 1 + a = file(fa).read() + if a != b: + ui.write(_(" patch test failed!")) + ui.write(_(" (you may have an incompatible version of patch)\n")) + problems += 1 + os.unlink(fa) os.unlink(fd) @@ -1550,7 +1551,7 @@ p2 = repo.lookup(p2) if p1 == wp[0].node(): repo.dirstate.setparents(p1, p2) - except RepoError: + except hg.RepoError: pass files = {} @@ -2375,44 +2376,27 @@ raise hg.RepoError(_("There is no Mercurial repository here" " (.hg not found)")) - if opts['daemon'] and not opts['daemon_pipefds']: - rfd, wfd = os.pipe() - args = sys.argv[:] - args.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) - pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), - args[0], args) - os.close(wfd) - os.read(rfd, 1) - os._exit(0) - - httpd = hgweb.server.create_server(parentui, repo) - - if ui.verbose: - if httpd.port != 80: - ui.status(_('listening at http://%s:%d/\n') % - (httpd.addr, httpd.port)) - else: - ui.status(_('listening at http://%s/\n') % httpd.addr) - - if opts['pid_file']: - fp = open(opts['pid_file'], 'w') - fp.write(str(os.getpid()) + '\n') - fp.close() - - if opts['daemon_pipefds']: - rfd, wfd = [int(x) for x in opts['daemon_pipefds'].split(',')] - os.close(rfd) - os.write(wfd, 'y') - os.close(wfd) - sys.stdout.flush() - sys.stderr.flush() - fd = os.open(util.nulldev, os.O_RDWR) - if fd != 0: os.dup2(fd, 0) - if fd != 1: os.dup2(fd, 1) - if fd != 2: os.dup2(fd, 2) - if fd not in (0, 1, 2): os.close(fd) - - httpd.serve_forever() + class service: + def init(self): + try: + self.httpd = hgweb.server.create_server(parentui, repo) + except socket.error, inst: + raise util.Abort(_('cannot start server: ') + inst.args[1]) + + if not ui.verbose: return + + if httpd.port != 80: + ui.status(_('listening at http://%s:%d/\n') % + (httpd.addr, httpd.port)) + else: + ui.status(_('listening at http://%s/\n') % httpd.addr) + + def run(self): + self.httpd.serve_forever() + + service = service() + + cmdutil.service(opts, initfn=service.init, runfn=service.run) def status(ui, repo, *pats, **opts): """show changed files in the working directory
--- a/mercurial/util.py Thu Apr 26 18:41:18 2007 -0500 +++ b/mercurial/util.py Sun Apr 29 12:33:24 2007 -0500 @@ -764,9 +764,6 @@ except: return True -_umask = os.umask(0) -os.umask(_umask) - def checkexec(path): """ Check whether the given path is on a filesystem with UNIX-like exec flags
--- a/mercurial/util_win32.py Thu Apr 26 18:41:18 2007 -0500 +++ b/mercurial/util_win32.py Sun Apr 29 12:33:24 2007 -0500 @@ -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
--- a/tests/run-tests.py Thu Apr 26 18:41:18 2007 -0500 +++ b/tests/run-tests.py Sun Apr 29 12:33:24 2007 -0500 @@ -346,8 +346,9 @@ HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc') os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"' -os.environ["HGMERGE"] = 'python "%s"' % os.path.join(TESTDIR, os.path.pardir, - 'contrib', 'simplemerge') +os.environ["HGMERGE"] = ('python "%s" -L my -L other' + % os.path.join(TESTDIR, os.path.pardir, 'contrib', + 'simplemerge')) os.environ["HGUSER"] = "test" os.environ["HGENCODING"] = "ascii" os.environ["HGENCODINGMODE"] = "strict"
--- a/tests/test-conflict Thu Apr 26 18:41:18 2007 -0500 +++ b/tests/test-conflict Sun Apr 29 12:33:24 2007 -0500 @@ -11,5 +11,5 @@ hg commit -m branch2 -d "1000000 0" hg merge 1 hg id -egrep -v ">>>|<<<" a +cat a hg status
--- a/tests/test-conflict.out Thu Apr 26 18:41:18 2007 -0500 +++ b/tests/test-conflict.out Sun Apr 29 12:33:24 2007 -0500 @@ -7,7 +7,9 @@ hg update -C 2 hg merge 1 e7fe8eb3e180+0d24b7662d3e+ tip +<<<<<<< my something else ======= something +>>>>>>> other M a
--- a/tests/test-merge-revert2 Thu Apr 26 18:41:18 2007 -0500 +++ b/tests/test-merge-revert2 Sun Apr 29 12:33:24 2007 -0500 @@ -27,7 +27,7 @@ hg update -C 0 echo "changed file1 different" >> file1 hg update -hg diff --nodates | sed -e "s/\(<<<<<<<\) .*/\1/" -e "s/\(>>>>>>>\) .*/\1/" +hg diff --nodates hg status hg id hg revert --no-backup --all
--- a/tests/test-merge-revert2.out Thu Apr 26 18:41:18 2007 -0500 +++ b/tests/test-merge-revert2.out Sun Apr 29 12:33:24 2007 -0500 @@ -23,11 +23,11 @@ @@ -1,3 +1,7 @@ added file1 added file1 another line of text -+<<<<<<< ++<<<<<<< my +changed file1 different +======= changed file1 -+>>>>>>> ++>>>>>>> other M file1 f248da0d4c3e+ tip reverting file1
--- a/tests/test-merge7 Thu Apr 26 18:41:18 2007 -0500 +++ b/tests/test-merge7 Sun Apr 29 12:33:24 2007 -0500 @@ -59,7 +59,7 @@ hg pull ../test-a hg merge --debug -cat test.txt | sed "s% .*%%" +cat test.txt hg debugindex .hg/store/data/test.txt.i
--- a/tests/test-merge7.out Thu Apr 26 18:41:18 2007 -0500 +++ b/tests/test-merge7.out Sun Apr 29 12:33:24 2007 -0500 @@ -33,11 +33,11 @@ hg update -C 3 hg merge 4 one -<<<<<<< +<<<<<<< my two-point-five ======= two-point-one ->>>>>>> +>>>>>>> other three rev offset length base linkrev nodeid p1 p2 0 0 7 0 0 01365c4cca56 000000000000 000000000000