merge with stable
authorMatt Mackall <mpm@selenic.com>
Tue, 15 May 2012 07:00:55 +0200
changeset 16727 3e24ce3de5f1
parent 16723 68da5ae6e470 (current diff)
parent 16726 7002bb17cc5e (diff)
child 16728 99f369f5a8db
merge with stable
hgext/largefiles/lfcommands.py
mercurial/hgweb/webcommands.py
--- a/hgext/largefiles/lfcommands.py	Sun May 13 22:59:22 2012 +0200
+++ b/hgext/largefiles/lfcommands.py	Tue May 15 07:00:55 2012 +0200
@@ -14,6 +14,7 @@
 from mercurial import util, match as match_, hg, node, context, error, \
     cmdutil, scmutil
 from mercurial.i18n import _
+from mercurial.lock import release
 
 import lfutil
 import basestore
@@ -55,10 +56,12 @@
     rdst = hg.repository(ui, dest, create=True)
 
     success = False
+    dstwlock = dstlock = None
     try:
         # Lock destination to prevent modification while it is converted to.
         # Don't need to lock src because we are just reading from its history
         # which can't change.
+        dstwlock = rdst.wlock()
         dstlock = rdst.lock()
 
         # Get a list of all changesets in the source.  The easy way to do this
@@ -111,10 +114,11 @@
             ui.progress(_('converting revisions'), None)
         success = True
     finally:
+        rdst.dirstate.clear()
+        release(dstlock, dstwlock)
         if not success:
             # we failed, remove the new directory
             shutil.rmtree(rdst.root)
-        dstlock.release()
 
 def _addchangeset(ui, rsrc, rdst, ctx, revmap):
  # Convert src parents to dst parents
--- a/mercurial/hgweb/webcommands.py	Sun May 13 22:59:22 2012 +0200
+++ b/mercurial/hgweb/webcommands.py	Tue May 15 07:00:55 2012 +0200
@@ -558,6 +558,7 @@
     if fctx is not None:
         n = fctx.node()
         path = fctx.path()
+        ctx = fctx.changectx()
     else:
         n = ctx.node()
         # path already defined in except clause
@@ -567,7 +568,7 @@
     if 'style' in req.form:
         style = req.form['style'][0]
 
-    diffs = webutil.diffs(web.repo, tmpl, fctx or ctx, [path], parity, style)
+    diffs = webutil.diffs(web.repo, tmpl, ctx, [path], parity, style)
     rename = fctx and webutil.renamelink(fctx) or []
     ctx = fctx and fctx or ctx
     return tmpl("filediff",
--- a/mercurial/posix.py	Sun May 13 22:59:22 2012 +0200
+++ b/mercurial/posix.py	Tue May 15 07:00:55 2012 +0200
@@ -409,10 +409,13 @@
                     continue
                 if not os.isatty(fd):
                     continue
-                arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
-                width = array.array('h', arri)[1]
-                if width > 0:
-                    return width
+                try:
+                    arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
+                    width = array.array('h', arri)[1]
+                    if width > 0:
+                        return width
+                except AttributeError:
+                    pass
             except ValueError:
                 pass
             except IOError, e:
--- a/tests/test-hgweb-commands.t	Sun May 13 22:59:22 2012 +0200
+++ b/tests/test-hgweb-commands.t	Tue May 15 07:00:55 2012 +0200
@@ -663,15 +663,24 @@
   </body>
   </html>
   
+  $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/filediff/0/foo/?style=raw'
+  200 Script output follows
+  
+  
+  diff -r 000000000000 -r 2ef0ac749a14 foo
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +foo
+  
+  
+  
+  
+
   $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/filediff/1/foo/?style=raw'
   200 Script output follows
   
   
-  diff -r 000000000000 -r a4f92ed23982 foo
-  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
-  @@ -0,0 +1,1 @@
-  +foo
   
   
   
--- a/tests/test-hgweb-diffs.t	Sun May 13 22:59:22 2012 +0200
+++ b/tests/test-hgweb-diffs.t	Tue May 15 07:00:55 2012 +0200
@@ -13,6 +13,7 @@
 change permissions for git diffs
 
   $ chmod +x a
+  $ hg rm b
   $ hg ci -Amb
 
 set up hgweb
@@ -90,7 +91,7 @@
   </tr>
   <tr>
    <th class="author">children</th>
-   <td class="author"> <a href="/rev/78e4ebad7cdf">78e4ebad7cdf</a></td>
+   <td class="author"> <a href="/rev/559edbd9ed20">559edbd9ed20</a></td>
   </tr>
   <tr>
    <th class="files">files</th>
@@ -177,7 +178,7 @@
 
 diff removed file
 
-  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/a'
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/b'
   200 Script output follows
   
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@@ -188,7 +189,7 @@
   <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
   <script type="text/javascript" src="/static/mercurial.js"></script>
   
-  <title>test: a diff</title>
+  <title>test: b diff</title>
   </head>
   <body>
   
@@ -199,23 +200,23 @@
   <img src="/static/hglogo.png" alt="mercurial" /></a>
   </div>
   <ul>
-  <li><a href="/shortlog/78e4ebad7cdf">log</a></li>
-  <li><a href="/graph/78e4ebad7cdf">graph</a></li>
+  <li><a href="/shortlog/559edbd9ed20">log</a></li>
+  <li><a href="/graph/559edbd9ed20">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/bookmarks">bookmarks</a></li>
   <li><a href="/branches">branches</a></li>
   </ul>
   <ul>
-  <li><a href="/rev/78e4ebad7cdf">changeset</a></li>
-  <li><a href="/file/78e4ebad7cdf">browse</a></li>
+  <li><a href="/rev/559edbd9ed20">changeset</a></li>
+  <li><a href="/file/559edbd9ed20">browse</a></li>
   </ul>
   <ul>
-  <li><a href="/file/78e4ebad7cdf/a">file</a></li>
-  <li><a href="/file/tip/a">latest</a></li>
+  <li><a href="/file/559edbd9ed20/b">file</a></li>
+  <li><a href="/file/tip/b">latest</a></li>
   <li class="active">diff</li>
-  <li><a href="/annotate/78e4ebad7cdf/a">annotate</a></li>
-  <li><a href="/log/78e4ebad7cdf/a">file log</a></li>
-  <li><a href="/raw-file/78e4ebad7cdf/a">raw</a></li>
+  <li><a href="/annotate/559edbd9ed20/b">annotate</a></li>
+  <li><a href="/log/559edbd9ed20/b">file log</a></li>
+  <li><a href="/raw-file/559edbd9ed20/b">raw</a></li>
   </ul>
   <ul>
   <li><a href="/help">help</a></li>
@@ -224,7 +225,7 @@
   
   <div class="main">
   <h2><a href="/">test</a></h2>
-  <h3>diff a @ 1:78e4ebad7cdf</h3>
+  <h3>diff b @ 1:559edbd9ed20</h3>
   
   <form class="search" action="/log">
   <p></p>
@@ -246,7 +247,7 @@
   </tr>
   <tr>
    <th>parents</th>
-   <td></td>
+   <td><a href="/file/0cd96de13884/b">0cd96de13884</a> </td>
   </tr>
   <tr>
    <th>children</th>
@@ -258,10 +259,10 @@
   <div class="overflow">
   <div class="sourcefirst">   line diff</div>
   
-  <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1">     1.1</a> <span class="minusline">--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-  </span><a href="#l1.2" id="l1.2">     1.2</a> <span class="plusline">+++ b/a	Thu Jan 01 00:00:00 1970 +0000
-  </span><a href="#l1.3" id="l1.3">     1.3</a> <span class="atline">@@ -0,0 +1,1 @@
-  </span><a href="#l1.4" id="l1.4">     1.4</a> <span class="plusline">+a
+  <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1">     1.1</a> <span class="minusline">--- a/b	Thu Jan 01 00:00:00 1970 +0000
+  </span><a href="#l1.2" id="l1.2">     1.2</a> <span class="plusline">+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  </span><a href="#l1.3" id="l1.3">     1.3</a> <span class="atline">@@ -1,1 +0,0 @@
+  </span><a href="#l1.4" id="l1.4">     1.4</a> <span class="minusline">-b
   </span></pre></div>
   </div>
   </div>
@@ -350,7 +351,7 @@
   </tr>
   <tr>
    <th class="author">children</th>
-   <td class="author"> <a href="/rev/78e4ebad7cdf">78e4ebad7cdf</a></td>
+   <td class="author"> <a href="/rev/559edbd9ed20">559edbd9ed20</a></td>
   </tr>
   <tr>
    <th class="files">files</th>
@@ -463,23 +464,23 @@
   <img src="/static/hglogo.png" alt="mercurial" /></a>
   </div>
   <ul>
-  <li><a href="/shortlog/78e4ebad7cdf">log</a></li>
-  <li><a href="/graph/78e4ebad7cdf">graph</a></li>
+  <li><a href="/shortlog/559edbd9ed20">log</a></li>
+  <li><a href="/graph/559edbd9ed20">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/bookmarks">bookmarks</a></li>
   <li><a href="/branches">branches</a></li>
   </ul>
   <ul>
-  <li><a href="/rev/78e4ebad7cdf">changeset</a></li>
-  <li><a href="/file/78e4ebad7cdf">browse</a></li>
+  <li><a href="/rev/559edbd9ed20">changeset</a></li>
+  <li><a href="/file/559edbd9ed20">browse</a></li>
   </ul>
   <ul>
-  <li><a href="/file/78e4ebad7cdf/a">file</a></li>
+  <li><a href="/file/559edbd9ed20/a">file</a></li>
   <li><a href="/file/tip/a">latest</a></li>
   <li class="active">diff</li>
-  <li><a href="/annotate/78e4ebad7cdf/a">annotate</a></li>
-  <li><a href="/log/78e4ebad7cdf/a">file log</a></li>
-  <li><a href="/raw-file/78e4ebad7cdf/a">raw</a></li>
+  <li><a href="/annotate/559edbd9ed20/a">annotate</a></li>
+  <li><a href="/log/559edbd9ed20/a">file log</a></li>
+  <li><a href="/raw-file/559edbd9ed20/a">raw</a></li>
   </ul>
   <ul>
   <li><a href="/help">help</a></li>
@@ -488,7 +489,7 @@
   
   <div class="main">
   <h2><a href="/">test</a></h2>
-  <h3>diff a @ 1:78e4ebad7cdf</h3>
+  <h3>diff a @ 1:559edbd9ed20</h3>
   
   <form class="search" action="/log">
   <p></p>
@@ -522,12 +523,9 @@
   <div class="overflow">
   <div class="sourcefirst">   line diff</div>
   
-  <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1">     1.1</a> new file mode 100755
-  <a href="#l1.2" id="l1.2">     1.2</a> <span class="minusline">--- /dev/null
-  </span><a href="#l1.3" id="l1.3">     1.3</a> <span class="plusline">+++ b/a
-  </span><a href="#l1.4" id="l1.4">     1.4</a> <span class="atline">@@ -0,0 +1,1 @@
-  </span><a href="#l1.5" id="l1.5">     1.5</a> <span class="plusline">+a
-  </span></pre></div>
+  <div class="source bottomline parity0"><pre><a href="#l1.1" id="l1.1">     1.1</a> old mode 100644
+  <a href="#l1.2" id="l1.2">     1.2</a> new mode 100755
+  </pre></div>
   </div>
   </div>
   </div>