diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
index f8b65ff02e3e607479b5d04b0609f60b698716a6_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..aff5996f30438d8808170d17eb5a7d2d9d8b2e74_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1177,7 +1177,7 @@
                 raise error.ProgrammingError('transaction requires locking')
         tr = self.currenttransaction()
         if tr is not None:
-            return tr.nest()
+            return tr.nest(name=desc)
 
         # abort here if the journal already exists
         if self.svfs.exists("journal"):
@@ -1316,7 +1316,8 @@
                                      self.store.createmode,
                                      validator=validate,
                                      releasefn=releasefn,
-                                     checkambigfiles=_cachedfiles)
+                                     checkambigfiles=_cachedfiles,
+                                     name=desc)
         tr.changes['revs'] = xrange(0, 0)
         tr.changes['obsmarkers'] = set()
         tr.changes['phases'] = {}
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
index f8b65ff02e3e607479b5d04b0609f60b698716a6_bWVyY3VyaWFsL3RyYW5zYWN0aW9uLnB5..aff5996f30438d8808170d17eb5a7d2d9d8b2e74_bWVyY3VyaWFsL3RyYW5zYWN0aW9uLnB5 100644
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -105,7 +105,7 @@
 class transaction(util.transactional):
     def __init__(self, report, opener, vfsmap, journalname, undoname=None,
                  after=None, createmode=None, validator=None, releasefn=None,
-                 checkambigfiles=None):
+                 checkambigfiles=None, name=r'<unnamed>'):
         """Begin a new transaction
 
         Begins a new transaction that allows rolling back writes in the event of
@@ -149,6 +149,8 @@
         if checkambigfiles:
             self.checkambigfiles.update(checkambigfiles)
 
+        self.names = [name]
+
         # A dict dedicated to precisely tracking the changes introduced in the
         # transaction.
         self.changes = {}
@@ -186,6 +188,11 @@
         # holds callbacks to call during abort
         self._abortcallback = {}
 
+    def __repr__(self):
+        name = r'/'.join(self.names)
+        return (r'<transaction name=%s, count=%d, usages=%d>' %
+                (name, self.count, self.usages))
+
     def __del__(self):
         if self.journal:
             self._abort()
@@ -365,6 +372,6 @@
         self.file.flush()
 
     @active
-    def nest(self):
+    def nest(self, name=r'<unnamed>'):
         self.count += 1
         self.usages += 1
@@ -369,7 +376,8 @@
         self.count += 1
         self.usages += 1
+        self.names.append(name)
         return self
 
     def release(self):
         if self.count > 0:
             self.usages -= 1
@@ -371,8 +379,10 @@
         return self
 
     def release(self):
         if self.count > 0:
             self.usages -= 1
+        if self.names:
+            self.names.pop()
         # if the transaction scopes are left without being closed, fail
         if self.count > 0 and self.usages == 0:
             self._abort()