diff --git a/hgext/rebase.py b/hgext/rebase.py
index a153a86a472c154a3e175615ccc8798b7c7ec76d_aGdleHQvcmViYXNlLnB5..2305baff673f8ae8e4e61a4dc529f2dc8cbe9574_aGdleHQvcmViYXNlLnB5 100644
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -115,4 +115,5 @@
 
     lock = wlock = None
     try:
+        wlock = repo.wlock()
         lock = repo.lock()
@@ -118,5 +119,4 @@
         lock = repo.lock()
-        wlock = repo.wlock()
 
         # Validate input and define rebasing points
         destf = opts.get('dest', None)