diff --git a/hgext/histedit.py b/hgext/histedit.py
index e12553cfd0a4d3714802392efdc8dbcf72410488_aGdleHQvaGlzdGVkaXQucHk=..7080652af6e61c3b358115d1ef48ced155594fe6_aGdleHQvaGlzdGVkaXQucHk= 100644
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1335,7 +1335,7 @@
     rules += '\n\n'
     rules += editcomment
     rules = ui.edit(rules, ui.username(), {'prefix': 'histedit'},
-                    tmpdir=repo.path)
+                    repopath=repo.path)
 
     # Save edit rules in .hg/histedit-last-edit.txt in case
     # the user needs to ask for help after something
diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
index e12553cfd0a4d3714802392efdc8dbcf72410488_aGdleHQvcGF0Y2hib21iLnB5..7080652af6e61c3b358115d1ef48ced155594fe6_aGdleHQvcGF0Y2hib21iLnB5 100644
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -271,7 +271,7 @@
     else:
         ui.write(_('\nWrite the introductory message for the '
                    'patch series.\n\n'))
-        body = ui.edit(defaultbody, sender, tmpdir=repo.path)
+        body = ui.edit(defaultbody, sender, repopath=repo.path)
         # Save series description in case sendmail fails
         msgfile = repo.vfs('last-email.txt', 'wb')
         msgfile.write(body)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
index e12553cfd0a4d3714802392efdc8dbcf72410488_bWVyY3VyaWFsL2NtZHV0aWwucHk=..7080652af6e61c3b358115d1ef48ced155594fe6_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -232,7 +232,7 @@
                              + fp.read())
                 reviewedpatch = ui.edit(patchtext, "",
                                         extra={"suffix": ".diff"},
-                                        tmpdir=repo.path)
+                                        repopath=repo.path)
                 fp.truncate(0)
                 fp.write(reviewedpatch)
                 fp.seek(0)
@@ -2782,7 +2782,7 @@
 
     editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(),
                               editform=editform, pending=pending,
-                              tmpdir=repo.path)
+                              repopath=repo.path)
     text = editortext
 
     # strip away anything below this special string (used for editors that want
diff --git a/mercurial/ui.py b/mercurial/ui.py
index e12553cfd0a4d3714802392efdc8dbcf72410488_bWVyY3VyaWFsL3VpLnB5..7080652af6e61c3b358115d1ef48ced155594fe6_bWVyY3VyaWFsL3VpLnB5 100644
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1022,7 +1022,7 @@
             self.write(*msg, **opts)
 
     def edit(self, text, user, extra=None, editform=None, pending=None,
-             tmpdir=None):
+             repopath=None):
         extra_defaults = {
             'prefix': 'editor',
             'suffix': '.txt',
@@ -1031,5 +1031,5 @@
             extra_defaults.update(extra)
         extra = extra_defaults
 
-        tdir = None
+        rdir = None
         if self.configbool('experimental', 'editortmpinhg'):
@@ -1035,4 +1035,4 @@
         if self.configbool('experimental', 'editortmpinhg'):
-            tdir = tmpdir
+            rdir = repopath
         (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-',
                                       suffix=extra['suffix'], text=True,
@@ -1037,6 +1037,6 @@
         (fd, name) = tempfile.mkstemp(prefix='hg-' + extra['prefix'] + '-',
                                       suffix=extra['suffix'], text=True,
-                                      dir=tdir)
+                                      dir=rdir)
         try:
             f = os.fdopen(fd, "w")
             f.write(text)