# HG changeset patch # User Vadim Gelfer # Date 1147210813 25200 # Node ID 56fddd98fef5e5fdf042e2745960689452e6d667 # Parent 5e5adc1910ed0e32855234a7cf70a018cbf4c914# Parent 25af3f17ce95d38fce90ec5012fa424a0befc870 merge with crew. diff -r 5e5adc1910ed -r 56fddd98fef5 Makefile --- a/Makefile Tue May 09 14:39:56 2006 -0700 +++ b/Makefile Tue May 09 14:40:13 2006 -0700 @@ -1,18 +1,34 @@ -# This Makefile is only used by developers. +PREFIX=/usr/local +export PREFIX PYTHON=python -all: +all: local build doc + +local: $(PYTHON) setup.py build_ext -i -install: - @echo "Read the file README for install instructions." +build: + $(PYTHON) setup.py build + +doc: + $(MAKE) -C doc clean: -$(PYTHON) setup.py clean --all # ignore errors of this command find . -name '*.py[co]' -exec rm -f '{}' ';' $(MAKE) -C doc clean -dist: tests doc +install: all + $(PYTHON) setup.py install --prefix="$(PREFIX)" --force + cd doc && $(MAKE) $(MFLAGS) install + +install-home: all + $(PYTHON) setup.py install --home="$(HOME)" --force + cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install + +dist: tests dist-notests + +dist-notests: doc TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py sdist --force-manifest tests: @@ -21,9 +37,6 @@ test-%: cd tests && $(PYTHON) run-tests.py $@ -doc: - $(MAKE) -C doc +.PHONY: all local build doc clean install install-home dist dist-notests tests -.PHONY: all clean dist tests doc - diff -r 5e5adc1910ed -r 56fddd98fef5 doc/Makefile --- a/doc/Makefile Tue May 09 14:39:56 2006 -0700 +++ b/doc/Makefile Tue May 09 14:40:13 2006 -0700 @@ -1,6 +1,9 @@ SOURCES=$(wildcard *.[0-9].txt) MAN=$(SOURCES:%.txt=%) HTML=$(SOURCES:%.txt=%.html) +PREFIX=/usr/local +MANDIR=$(PREFIX)/man +INSTALL=install -c all: man html @@ -23,5 +26,12 @@ %.html: %.txt asciidoc -b html4 $*.txt || asciidoc -b html $*.txt +install: man + for i in $(MAN) ; do \ + subdir=`echo $$i | sed -n 's/.\+\(\.[0-9]\)$$/man\1/p'` ; \ + mkdir -p $(MANDIR)/$$subdir ; \ + $(INSTALL) $$i $(MANDIR)/$$subdir ; \ + done + clean: $(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) *.[0-9].gendoc.txt diff -r 5e5adc1910ed -r 56fddd98fef5 mercurial/appendfile.py --- a/mercurial/appendfile.py Tue May 09 14:39:56 2006 -0700 +++ b/mercurial/appendfile.py Tue May 09 14:40:13 2006 -0700 @@ -130,13 +130,19 @@ tmpnames = self.tmpnames.items() tmpnames.sort() for name, tmpname in tmpnames: - fp = open(tmpname, 'rb') - s = fp.read() - fp.close() + ifp = open(tmpname, 'rb') + ofp = self.realopener(name, 'a') + for chunk in util.filechunkiter(ifp): + ofp.write(chunk) + ifp.close() os.unlink(tmpname) - fp = self.realopener(name, 'a') - fp.write(s) - fp.close() + del self.tmpnames[name] + ofp.close() + + def cleanup(self): + '''delete temp files (this discards unwritten data!)''' + for tmpname in self.tmpnames.values(): + os.unlink(tmpname) # files for changelog and manifest are in different appendopeners, so # not mixed up together. diff -r 5e5adc1910ed -r 56fddd98fef5 mercurial/commands.py --- a/mercurial/commands.py Tue May 09 14:39:56 2006 -0700 +++ b/mercurial/commands.py Tue May 09 14:40:13 2006 -0700 @@ -2712,6 +2712,7 @@ release. Please use the rollback command instead. For usage instructions, see the rollback command. """ + ui.warn(_('(the undo command is deprecated; use rollback instead)\n')) repo.undo() def update(ui, repo, node=None, merge=False, clean=False, force=None, diff -r 5e5adc1910ed -r 56fddd98fef5 mercurial/localrepo.py --- a/mercurial/localrepo.py Tue May 09 14:39:56 2006 -0700 +++ b/mercurial/localrepo.py Tue May 09 14:40:13 2006 -0700 @@ -1477,46 +1477,57 @@ # write changelog and manifest data to temp files so # concurrent readers will not see inconsistent view - cl = appendfile.appendchangelog(self.opener, self.changelog.version) + cl = None + try: + cl = appendfile.appendchangelog(self.opener, self.changelog.version) - oldheads = len(cl.heads()) + oldheads = len(cl.heads()) - # pull off the changeset group - self.ui.status(_("adding changesets\n")) - co = cl.tip() - chunkiter = changegroup.chunkiter(source) - cn = cl.addgroup(chunkiter, csmap, tr, 1) # unique - cnr, cor = map(cl.rev, (cn, co)) - if cn == nullid: - cnr = cor - changesets = cnr - cor + # pull off the changeset group + self.ui.status(_("adding changesets\n")) + co = cl.tip() + chunkiter = changegroup.chunkiter(source) + cn = cl.addgroup(chunkiter, csmap, tr, 1) # unique + cnr, cor = map(cl.rev, (cn, co)) + if cn == nullid: + cnr = cor + changesets = cnr - cor - mf = appendfile.appendmanifest(self.opener, self.manifest.version) + mf = None + try: + mf = appendfile.appendmanifest(self.opener, + self.manifest.version) - # pull off the manifest group - self.ui.status(_("adding manifests\n")) - mm = mf.tip() - chunkiter = changegroup.chunkiter(source) - mo = mf.addgroup(chunkiter, revmap, tr) + # pull off the manifest group + self.ui.status(_("adding manifests\n")) + mm = mf.tip() + chunkiter = changegroup.chunkiter(source) + mo = mf.addgroup(chunkiter, revmap, tr) - # process the files - self.ui.status(_("adding file changes\n")) - while 1: - f = changegroup.getchunk(source) - if not f: - break - self.ui.debug(_("adding %s revisions\n") % f) - fl = self.file(f) - o = fl.count() - chunkiter = changegroup.chunkiter(source) - n = fl.addgroup(chunkiter, revmap, tr) - revisions += fl.count() - o - files += 1 + # process the files + self.ui.status(_("adding file changes\n")) + while 1: + f = changegroup.getchunk(source) + if not f: + break + self.ui.debug(_("adding %s revisions\n") % f) + fl = self.file(f) + o = fl.count() + chunkiter = changegroup.chunkiter(source) + n = fl.addgroup(chunkiter, revmap, tr) + revisions += fl.count() - o + files += 1 - # write order here is important so concurrent readers will see - # consistent view of repo - mf.writedata() - cl.writedata() + # write order here is important so concurrent readers will see + # consistent view of repo + mf.writedata() + finally: + if mf: + mf.cleanup() + cl.writedata() + finally: + if cl: + cl.cleanup() # make changelog and manifest see real files again self.changelog = changelog.changelog(self.opener, self.changelog.version) diff -r 5e5adc1910ed -r 56fddd98fef5 mercurial/util.py --- a/mercurial/util.py Tue May 09 14:39:56 2006 -0700 +++ b/mercurial/util.py Tue May 09 14:40:13 2006 -0700 @@ -685,20 +685,22 @@ d, fn = os.path.split(name) fd, temp = tempfile.mkstemp(prefix='.%s-' % fn, dir=d) os.close(fd) - fp = posixfile(temp, "wb") + ofp = posixfile(temp, "wb") try: try: - s = posixfile(name, "rb").read() + ifp = posixfile(name, "rb") except IOError, inst: if not getattr(inst, 'filename', None): inst.filename = name raise - fp.write(s) + for chunk in filechunkiter(ifp): + ofp.write(chunk) + ifp.close() + ofp.close() except: try: os.unlink(temp) except: pass raise - fp.close() st = os.lstat(name) os.chmod(temp, st.st_mode) return temp