diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ help: @echo ' all - build program and documentation' @echo ' install - install program and man pages to PREFIX ($(PREFIX))' @echo ' install-home - install with setup.py install --home=HOME ($(HOME))' - @echo ' local - build C extensions for inplace usage' + @echo ' local - build for inplace usage' @echo ' tests - run all tests in the automatic test suite' @echo ' test-foo - run only specified tests (e.g. test-merge1)' @echo ' dist - run all tests and create a source tarball in dist/' @@ -24,6 +24,8 @@ all: build doc local: $(PYTHON) setup.py build_ext -i + $(PYTHON) setup.py build_py -c -d . + $(PYTHON) hg version build: $(PYTHON) setup.py build @@ -33,7 +35,7 @@ doc: clean: -$(PYTHON) setup.py clean --all # ignore errors of this command - find . -name '*.py[co]' -exec rm -f '{}' ';' + find . -name '*.py[cdo]' -exec rm -f '{}' ';' rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err $(MAKE) -C doc clean diff --git a/doc/hgrc.5.txt b/doc/hgrc.5.txt --- a/doc/hgrc.5.txt +++ b/doc/hgrc.5.txt @@ -525,6 +525,8 @@ web:: Default is "unknown". errorlog;; Where to output the error log. Default is stderr. + hidden;; + Whether to hide the repository in the hgwebdir index. Default is false. ipv6;; Whether to use IPv6. Default is false. name;; diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -30,7 +30,8 @@ refresh contents of top applied patch ''' from mercurial.i18n import _ -from mercurial import commands, cmdutil, hg, patch, revlog, util, changegroup +from mercurial import commands, cmdutil, hg, patch, revlog, util +from mercurial import repair import os, sys, re, errno commands.norepo += " qclone qversion" @@ -629,71 +630,9 @@ class queue: self.removeundo(repo) def strip(self, repo, rev, update=True, backup="all", wlock=None): - def limitheads(chlog, stop): - """return the list of all nodes that have no children""" - p = {} - h = [] - stoprev = 0 - if stop in chlog.nodemap: - stoprev = chlog.rev(stop) - - for r in xrange(chlog.count() - 1, -1, -1): - n = chlog.node(r) - if n not in p: - h.append(n) - if n == stop: - break - if r < stoprev: - break - for pn in chlog.parents(n): - p[pn] = 1 - return h - - def bundle(cg): - backupdir = repo.join("strip-backup") - if not os.path.isdir(backupdir): - os.mkdir(backupdir) - name = os.path.join(backupdir, "%s" % revlog.short(rev)) - name = savename(name) - self.ui.warn("saving bundle to %s\n" % name) - return changegroup.writebundle(cg, name, "HG10BZ") - - def stripall(revnum): - mm = repo.changectx(rev).manifest() - seen = {} - - for x in xrange(revnum, repo.changelog.count()): - for f in repo.changectx(x).files(): - if f in seen: - continue - seen[f] = 1 - if f in mm: - filerev = mm[f] - else: - filerev = 0 - seen[f] = filerev - # we go in two steps here so the strip loop happens in a - # sensible order. When stripping many files, this helps keep - # our disk access patterns under control. - seen_list = seen.keys() - seen_list.sort() - for f in seen_list: - ff = repo.file(f) - filerev = seen[f] - if filerev != 0: - if filerev in ff.nodemap: - filerev = ff.rev(filerev) - else: - filerev = 0 - ff.strip(filerev, revnum) - if not wlock: wlock = repo.wlock() lock = repo.lock() - chlog = repo.changelog - # TODO delete the undo files, and handle undo of merge sets - pp = chlog.parents(rev) - revnum = chlog.rev(rev) if update: self.check_localchanges(repo, refresh=False) @@ -701,62 +640,8 @@ class queue: hg.clean(repo, urev, wlock=wlock) repo.dirstate.write() - # save is a list of all the branches we are truncating away - # that we actually want to keep. changegroup will be used - # to preserve them and add them back after the truncate - saveheads = [] - savebases = {} - - heads = limitheads(chlog, rev) - seen = {} - - # search through all the heads, finding those where the revision - # we want to strip away is an ancestor. Also look for merges - # that might be turned into new heads by the strip. - while heads: - h = heads.pop() - n = h - while True: - seen[n] = 1 - pp = chlog.parents(n) - if pp[1] != revlog.nullid: - for p in pp: - if chlog.rev(p) > revnum and p not in seen: - heads.append(p) - if pp[0] == revlog.nullid: - break - if chlog.rev(pp[0]) < revnum: - break - n = pp[0] - if n == rev: - break - r = chlog.reachable(h, rev) - if rev not in r: - saveheads.append(h) - for x in r: - if chlog.rev(x) > revnum: - savebases[x] = 1 - - # create a changegroup for all the branches we need to keep - if backup == "all": - backupch = repo.changegroupsubset([rev], chlog.heads(), 'strip') - bundle(backupch) - if saveheads: - backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip') - chgrpfile = bundle(backupch) - - stripall(revnum) - - change = chlog.read(rev) - chlog.strip(revnum, revnum) - repo.manifest.strip(repo.manifest.rev(change[0]), revnum) self.removeundo(repo) - if saveheads: - self.ui.status("adding branch\n") - commands.unbundle(self.ui, repo, "file:%s" % chgrpfile, - update=False) - if backup != "strip": - os.unlink(chgrpfile) + repair.strip(self.ui, repo, rev, backup) def isapplied(self, patch): """returns (index, rev, patch)""" diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -142,6 +142,9 @@ class hgwebdir(object): def get(section, name, default=None): return u.config(section, name, default, untrusted=True) + if u.configbool("web", "hidden", untrusted=True): + continue + url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name]) .replace("//", "/")) + '/' diff --git a/mercurial/repair.py b/mercurial/repair.py new file mode 100644 --- /dev/null +++ b/mercurial/repair.py @@ -0,0 +1,127 @@ +# repair.py - functions for repository repair for mercurial +# +# Copyright 2005, 2006 Chris Mason +# Copyright 2007 Matt Mackall +# +# This software may be used and distributed according to the terms +# of the GNU General Public License, incorporated herein by reference. + +import changegroup, revlog, os, commands + +def strip(ui, repo, rev, backup="all"): + def limitheads(chlog, stop): + """return the list of all nodes that have no children""" + p = {} + h = [] + stoprev = 0 + if stop in chlog.nodemap: + stoprev = chlog.rev(stop) + + for r in xrange(chlog.count() - 1, -1, -1): + n = chlog.node(r) + if n not in p: + h.append(n) + if n == stop: + break + if r < stoprev: + break + for pn in chlog.parents(n): + p[pn] = 1 + return h + + def bundle(repo, bases, heads, rev, suffix): + cg = repo.changegroupsubset(bases, heads, 'strip') + backupdir = repo.join("strip-backup") + if not os.path.isdir(backupdir): + os.mkdir(backupdir) + name = os.path.join(backupdir, "%s-%s" % (revlog.short(rev), suffix)) + ui.warn("saving bundle to %s\n" % name) + return changegroup.writebundle(cg, name, "HG10BZ") + + def stripall(revnum): + mm = repo.changectx(rev).manifest() + seen = {} + + for x in xrange(revnum, repo.changelog.count()): + for f in repo.changectx(x).files(): + if f in seen: + continue + seen[f] = 1 + if f in mm: + filerev = mm[f] + else: + filerev = 0 + seen[f] = filerev + # we go in two steps here so the strip loop happens in a + # sensible order. When stripping many files, this helps keep + # our disk access patterns under control. + seen_list = seen.keys() + seen_list.sort() + for f in seen_list: + ff = repo.file(f) + filerev = seen[f] + if filerev != 0: + if filerev in ff.nodemap: + filerev = ff.rev(filerev) + else: + filerev = 0 + ff.strip(filerev, revnum) + + chlog = repo.changelog + # TODO delete the undo files, and handle undo of merge sets + pp = chlog.parents(rev) + revnum = chlog.rev(rev) + + # save is a list of all the branches we are truncating away + # that we actually want to keep. changegroup will be used + # to preserve them and add them back after the truncate + saveheads = [] + savebases = {} + + heads = limitheads(chlog, rev) + seen = {} + + # search through all the heads, finding those where the revision + # we want to strip away is an ancestor. Also look for merges + # that might be turned into new heads by the strip. + while heads: + h = heads.pop() + n = h + while True: + seen[n] = 1 + pp = chlog.parents(n) + if pp[1] != revlog.nullid: + for p in pp: + if chlog.rev(p) > revnum and p not in seen: + heads.append(p) + if pp[0] == revlog.nullid: + break + if chlog.rev(pp[0]) < revnum: + break + n = pp[0] + if n == rev: + break + r = chlog.reachable(h, rev) + if rev not in r: + saveheads.append(h) + for x in r: + if chlog.rev(x) > revnum: + savebases[x] = 1 + + # create a changegroup for all the branches we need to keep + if backup == "all": + bundle(repo, [rev], chlog.heads(), rev, 'backup') + if saveheads: + chgrpfile = bundle(repo, savebases.keys(), saveheads, rev, 'temp') + + stripall(revnum) + + change = chlog.read(rev) + chlog.strip(revnum, revnum) + repo.manifest.strip(repo.manifest.rev(change[0]), revnum) + if saveheads: + ui.status("adding branch\n") + commands.unbundle(ui, repo, "file:%s" % chgrpfile, update=False) + if backup != "strip": + os.unlink(chgrpfile) + diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -105,6 +105,7 @@ defaultdateformats = ( '%m/%d/%Y', '%a %b %d %H:%M:%S %Y', '%a %b %d %I:%M:%S%p %Y', + '%a, %d %b %Y %H:%M:%S', # GNU coreutils "/bin/date --rfc-2822" '%b %d %H:%M:%S %Y', '%b %d %I:%M:%S%p %Y', '%b %d %H:%M:%S', diff --git a/templates/gitweb/map b/templates/gitweb/map --- a/templates/gitweb/map +++ b/templates/gitweb/map @@ -48,7 +48,7 @@ filelogchild = 'ch shortlog = shortlog.tmpl tagtag = '{name} ' branchtag = '{name} ' -shortlogentry = '#date|age# ago#author##desc|strip|firstline|escape# {branches%branchtag}{tags%tagtag}changeset | manifest' +shortlogentry = '#date|age# ago#author|person##desc|strip|firstline|escape# {branches%branchtag}{tags%tagtag}changeset | manifest' filelogentry = '#date|age# ago#desc|strip|firstline|escape#file | diff | annotate #rename%filelogrename#' archiveentry = ' | #type|escape# ' indexentry = '#name|escape##description##contact|obfuscate##lastchange|age# ago #archives%archiveentry#' diff --git a/templates/gitweb/summary.tmpl b/templates/gitweb/summary.tmpl --- a/templates/gitweb/summary.tmpl +++ b/templates/gitweb/summary.tmpl @@ -32,10 +32,10 @@ summary | last change#lastchange|rfc822date# -
changes
+
changes
#shortlog# - +
...
...
tags
diff --git a/templates/map b/templates/map --- a/templates/map +++ b/templates/map @@ -1,4 +1,4 @@ -default = 'changelog' +default = 'shortlog' header = header.tmpl footer = footer.tmpl search = search.tmpl diff --git a/templates/shortlogentry.tmpl b/templates/shortlogentry.tmpl --- a/templates/shortlogentry.tmpl +++ b/templates/shortlogentry.tmpl @@ -1,7 +1,7 @@ - +
#date|age##author|obfuscate##author|person# #desc|strip|firstline|escape#
diff --git a/templates/static/style.css b/templates/static/style.css --- a/templates/static/style.css +++ b/templates/static/style.css @@ -58,10 +58,10 @@ pre { margin: 0; } .logEntry th.firstline { text-align: left; width: inherit; } /* Shortlog entries */ -.slogEntry { width: 100%; font-size: smaller; } -.slogEntry .age { width: 7%; } +.slogEntry { width: 100%; } +.slogEntry .age { width: 8em; } .slogEntry td { font-weight: normal; text-align: left; vertical-align: top; } -.slogEntry td.author { width: 35%; } +.slogEntry td.author { width: 15em; } /* Tag entries */ #tagEntries { list-style: none; margin: 0; padding: 0; }