diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
index f766882000c7bf2596e98abd43e460322a87c02c_bWVyY3VyaWFsL3N1YnJlcG8ucHk=..9bb180abc4d07f1b6fac20125e8c14f245c2e057_bWVyY3VyaWFsL3N1YnJlcG8ucHk= 100644
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -549,7 +549,7 @@
                             'it has changes.\n' % self._path))
             return
         self._ui.note(_('removing subrepo %s\n') % self._path)
-        shutil.rmtree(self._ctx.repo.join(self._path))
+        shutil.rmtree(self._ctx._repo.wjoin(self._path))
 
     def get(self, state):
         status = self._svncommand(['checkout', state[0], '--revision', state[1]])
diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t
index f766882000c7bf2596e98abd43e460322a87c02c_dGVzdHMvdGVzdC1zdWJyZXBvLXN2bi50..9bb180abc4d07f1b6fac20125e8c14f245c2e057_dGVzdHMvdGVzdC1zdWJyZXBvLXN2bi50 100644
--- a/tests/test-subrepo-svn.t
+++ b/tests/test-subrepo-svn.t
@@ -217,3 +217,8 @@
 
   $ python -c "import os.path; print os.path.exists('s')"
   True
+
+update to nullrev (must delete the subrepo)
+
+  $ hg up null
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved