shelve: allow unlimited shelved changes per name
authorJun Wu <quark@fb.com>
Tue, 20 Jun 2017 23:39:59 -0700
changeset 32986 4107eb8a5648
parent 32985 cd2fd1765654
child 32987 30d0cb279bac
shelve: allow unlimited shelved changes per name Previously, there is a 100 changes limit per name (bookmark or named branch). And the user will get "too many shelved changes named %s" when they are trying to shelve the 101th change. I hit that error message today. This limit was introduced by the shelve extension since the beginning. The function generating the names was called "gennames", under "getshelvename". There is another "gennames" under "backupfilename": def backupfilename(self): def gennames(base): yield base base, ext = base.rsplit('.', 1) for i in itertools.count(1): yield '%s-%d.%s' % (base, i, ext) "itertools.count" is an endless counter. Since the other "gennames" generates unlimited number of names, and the changeset introducing the limit (49d4919d21) does not say why the limit is useful. It seems safe to just remove the limit. The format "%02d" was kept intentionally so existing shelved changes won't break.
hgext/shelve.py
--- a/hgext/shelve.py	Sat Jun 17 12:51:37 2017 +0200
+++ b/hgext/shelve.py	Tue Jun 20 23:39:59 2017 -0700
@@ -316,7 +316,7 @@
     """Decide on the name this shelve is going to have"""
     def gennames():
         yield label
-        for i in xrange(1, 100):
+        for i in itertools.count(1):
             yield '%s-%02d' % (label, i)
     name = opts.get('name')
     label = repo._activebookmark or parent.branch() or 'default'
@@ -343,8 +343,6 @@
             if not shelvedfile(repo, n, patchextension).exists():
                 name = n
                 break
-        else:
-            raise error.Abort(_("too many shelved changes named '%s'") % label)
 
     return name