changeset 1560:2cf2fb2e2d15 default tip

merged crew or orig repo
author twaldmann@thinkmo.de
date Sat, 26 Nov 2005 12:54:48 +0100
parents 98398a6ddd75 (current diff) 68ec7b9e09a4 (diff)
children
files mercurial/commands.py mercurial/hgweb.py mercurial/localrepo.py
diffstat 9 files changed, 60 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Nov 15 23:41:24 2005 +0100
+++ b/mercurial/commands.py	Sat Nov 26 12:54:48 2005 +0100
@@ -1288,11 +1288,14 @@
     changesets. They are where development generally takes place and
     are the usual targets for update and merge operations.
     """
-    heads = repo.changelog.heads()
+    if opts['rev']:
+        heads = repo.heads(repo.lookup(opts['rev']))
+    else:
+        heads = repo.heads()
     br = None
     if opts['branches']:
         br = repo.branchlookup(heads)
-    for n in repo.changelog.heads():
+    for n in heads:
         show_changeset(ui, repo, changenode=n, brinfo=br)
 
 def identify(ui, repo):
@@ -2239,8 +2242,9 @@
          "hg grep [OPTION]... PATTERN [FILE]..."),
     "heads":
         (heads,
-         [('b', 'branches', None, _('find branch info'))],
-         _('hg heads [-b]')),
+         [('b', 'branches', None, _('find branch info')),
+          ('r', 'rev', "", _('show only heads which are descendants of rev'))],
+         _('hg heads [-b] [-r <rev>]')),
     "help": (help_, [], _('hg help [COMMAND]')),
     "identify|id": (identify, [], _('hg identify')),
     "import|patch":
@@ -2649,6 +2653,8 @@
     except:
         u.warn(_("** unknown exception encountered, details follow\n"))
         u.warn(_("** report bug details to mercurial@selenic.com\n"))
+        u.warn(_("** Mercurial Distributed SCM (version %s)\n")
+               % version.get_version())
         raise
 
     sys.exit(-1)
--- a/mercurial/hgweb.py	Tue Nov 15 23:41:24 2005 +0100
+++ b/mercurial/hgweb.py	Sat Nov 26 12:54:48 2005 +0100
@@ -1013,7 +1013,12 @@
         if virtual:
             real = dict(self.repos).get(virtual)
             if real:
-                hgweb(real).run(req)
+                try:
+                    hgweb(real).run(req)
+                except IOError, inst:
+                    req.write(tmpl("error", error=inst.strerror))
+                except hg.RepoError, inst:
+                    req.write(tmpl("error", error=str(inst)))
             else:
                 req.write(tmpl("notfound", repo=virtual))
         else:
--- a/mercurial/localrepo.py	Tue Nov 15 23:41:24 2005 +0100
+++ b/mercurial/localrepo.py	Sat Nov 26 12:54:48 2005 +0100
@@ -613,8 +613,12 @@
                 self.dirstate.update([dest], "a")
             self.dirstate.copy(source, dest)
 
-    def heads(self):
-        return self.changelog.heads()
+    def heads(self, start=None):
+        heads = self.changelog.heads(start)
+        # sort the output in rev descending order
+        heads = [(-self.changelog.rev(h), h) for h in heads]
+        heads.sort()
+        return [n for (r, n) in heads]
 
     # branchlookup returns a dict giving a list of branches for
     # each head.  A branch is defined as the tag of a node or
--- a/mercurial/revlog.py	Tue Nov 15 23:41:24 2005 +0100
+++ b/mercurial/revlog.py	Sat Nov 26 12:54:48 2005 +0100
@@ -409,25 +409,28 @@
         assert heads
         return (orderedout, roots, heads)
 
-    def heads(self, stop=None):
-        """return the list of all nodes that have no children"""
-        p = {}
-        h = []
-        stoprev = 0
-        if stop and stop in self.nodemap:
-            stoprev = self.rev(stop)
+    def heads(self, start=None):
+        """return the list of all nodes that have no children
+
+        if start is specified, only heads that are descendants of
+        start will be returned
 
-        for r in range(self.count() - 1, -1, -1):
+        """
+        if start is None:
+            start = nullid
+        reachable = {start: 1}
+        heads = {start: 1}
+        startrev = self.rev(start)
+
+        for r in xrange(startrev + 1, self.count()):
             n = self.node(r)
-            if n not in p:
-                h.append(n)
-            if n == stop:
-                break
-            if r < stoprev:
-                break
             for pn in self.parents(n):
-                p[pn] = 1
-        return h
+                if pn in reachable:
+                    reachable[n] = 1
+                    heads[n] = 1
+                if pn in heads:
+                    del heads[pn]
+        return heads.keys()
 
     def children(self, node):
         """find the children of a given node"""
--- a/setup.py	Tue Nov 15 23:41:24 2005 +0100
+++ b/setup.py	Sat Nov 26 12:54:48 2005 +0100
@@ -75,7 +75,7 @@
     py2exe_opts = {}
     if py2exe_for_demandload is not None:
         cmdclass['py2exe'] = py2exe_for_demandload
-        py2exe_opts['console'] = 'hg'
+        py2exe_opts['console'] = ['hg']
     setup(name='mercurial',
           version=mercurial.version.get_version(),
           author='Matt Mackall',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/error.tmpl	Sat Nov 26 12:54:48 2005 +0100
@@ -0,0 +1,15 @@
+#header#
+<title>Mercurial Error</title>
+</head>
+<body>
+
+<h2>Mercurial Error</h2>
+
+<p>
+An error occured while processing your request:
+</p>
+<p>
+#error|escape#
+</p>
+
+#footer#
--- a/templates/map	Tue Nov 15 23:41:24 2005 +0100
+++ b/templates/map	Sat Nov 26 12:54:48 2005 +0100
@@ -39,3 +39,4 @@
 index = index.tmpl
 archiveentry = "<a href="?ca=#node|short#;type=#type#">#type#</a> "
 notfound = notfound.tmpl
+error = error.tmpl
--- a/templates/notfound.tmpl	Tue Nov 15 23:41:24 2005 +0100
+++ b/templates/notfound.tmpl	Sat Nov 26 12:54:48 2005 +0100
@@ -5,7 +5,7 @@
 
 <h2>Mercurial Repositories</h2>
 
-The specified repository "#repo#" is unknown, sorry.
+The specified repository "#repo|escape#" is unknown, sorry.
 
 Please go back to the main repository list page.
 
--- a/templates/tags.tmpl	Tue Nov 15 23:41:24 2005 +0100
+++ b/templates/tags.tmpl	Sat Nov 26 12:54:48 2005 +0100
@@ -1,5 +1,5 @@
 #header#
-<title>#repo#: tags</title>
+<title>#repo|escape#: tags</title>
 </head>
 <body>