merge with stable
authorMatt Mackall <mpm@selenic.com>
Thu, 27 Feb 2014 14:48:36 -0600
changeset 20578 e0e223b0a506
parent 20574 5614f8cf0861 (current diff)
parent 20577 de48422df393 (diff)
child 20579 625533523c9e
merge with stable
mercurial/commands.py
--- a/mercurial/commands.py	Thu Feb 27 14:46:29 2014 -0600
+++ b/mercurial/commands.py	Thu Feb 27 14:48:36 2014 -0600
@@ -4590,47 +4590,50 @@
     """
     source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
     other = hg.peer(repo, opts, source)
-    ui.status(_('pulling from %s\n') % util.hidepassword(source))
-    revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
-
-    remotebookmarks = other.listkeys('bookmarks')
-
-    if opts.get('bookmark'):
-        if not revs:
-            revs = []
-        for b in opts['bookmark']:
-            if b not in remotebookmarks:
-                raise util.Abort(_('remote bookmark %s not found!') % b)
-            revs.append(remotebookmarks[b])
-
-    if revs:
+    try:
+        ui.status(_('pulling from %s\n') % util.hidepassword(source))
+        revs, checkout = hg.addbranchrevs(repo, other, branches,
+                                          opts.get('rev'))
+
+        remotebookmarks = other.listkeys('bookmarks')
+
+        if opts.get('bookmark'):
+            if not revs:
+                revs = []
+            for b in opts['bookmark']:
+                if b not in remotebookmarks:
+                    raise util.Abort(_('remote bookmark %s not found!') % b)
+                revs.append(remotebookmarks[b])
+
+        if revs:
+            try:
+                revs = [other.lookup(rev) for rev in revs]
+            except error.CapabilityError:
+                err = _("other repository doesn't support revision lookup, "
+                        "so a rev cannot be specified.")
+                raise util.Abort(err)
+
+        modheads = repo.pull(other, heads=revs, force=opts.get('force'))
+        bookmarks.updatefromremote(ui, repo, remotebookmarks, source)
+        if checkout:
+            checkout = str(repo.changelog.rev(other.lookup(checkout)))
+        repo._subtoppath = source
         try:
-            revs = [other.lookup(rev) for rev in revs]
-        except error.CapabilityError:
-            err = _("other repository doesn't support revision lookup, "
-                    "so a rev cannot be specified.")
-            raise util.Abort(err)
-
-    modheads = repo.pull(other, heads=revs, force=opts.get('force'))
-    bookmarks.updatefromremote(ui, repo, remotebookmarks, source)
-    if checkout:
-        checkout = str(repo.changelog.rev(other.lookup(checkout)))
-    repo._subtoppath = source
-    try:
-        ret = postincoming(ui, repo, modheads, opts.get('update'), checkout)
-
+            ret = postincoming(ui, repo, modheads, opts.get('update'), checkout)
+
+        finally:
+            del repo._subtoppath
+
+        # update specified bookmarks
+        if opts.get('bookmark'):
+            marks = repo._bookmarks
+            for b in opts['bookmark']:
+                # explicit pull overrides local bookmark if any
+                ui.status(_("importing bookmark %s\n") % b)
+                marks[b] = repo[remotebookmarks[b]].node()
+            marks.write()
     finally:
-        del repo._subtoppath
-
-    # update specified bookmarks
-    if opts.get('bookmark'):
-        marks = repo._bookmarks
-        for b in opts['bookmark']:
-            # explicit pull overrides local bookmark if any
-            ui.status(_("importing bookmark %s\n") % b)
-            marks[b] = repo[remotebookmarks[b]].node()
-        marks.write()
-
+        other.close()
     return ret
 
 @command('^push',
--- a/mercurial/hgweb/hgwebdir_mod.py	Thu Feb 27 14:46:29 2014 -0600
+++ b/mercurial/hgweb/hgwebdir_mod.py	Thu Feb 27 14:48:36 2014 -0600
@@ -365,7 +365,8 @@
                            description_sort=description.upper() or "unknown",
                            lastchange=d,
                            lastchange_sort=d[1]-d[0],
-                           archives=archivelist(u, "tip", url))
+                           archives=archivelist(u, "tip", url),
+                           isdirectory=None)
 
                 seenrepos.add(name)
                 yield row
--- a/mercurial/templates/static/style-coal.css	Thu Feb 27 14:46:29 2014 -0600
+++ b/mercurial/templates/static/style-coal.css	Thu Feb 27 14:48:36 2014 -0600
@@ -214,6 +214,13 @@
 .source a { color: #999; font-size: smaller; font-family: monospace;}
 .bottomline { border-bottom: 1px solid #999; }
 
+.sourcelines > div {
+  display: inline-block;
+  width: 100%;
+  padding: 1px 0px;
+  counter-increment: lineno;
+}
+
 .fileline { font-family: monospace; }
 .fileline img { border: 0; }
 
--- a/tests/test-bundle.t	Thu Feb 27 14:46:29 2014 -0600
+++ b/tests/test-bundle.t	Thu Feb 27 14:48:36 2014 -0600
@@ -84,6 +84,11 @@
   searching for changes
   no changes found
 
+Verify that there are no leaked temporary files after pull (issue2797)
+
+  $ ls test/.hg | grep .hg10un
+  [1]
+
 Pull full.hg into empty (using --cwd)
 
   $ hg --cwd empty pull ../full.hg