[PATCH V2] shelve: allow unlimited shelved changes per name
Martin von Zweigbergk
martinvonz at google.com
Wed Jun 21 06:46:56 UTC 2017
On Tue, Jun 20, 2017 at 11:40 PM, Jun Wu <quark at fb.com> wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1498027199 25200
> # Tue Jun 20 23:39:59 2017 -0700
> # Node ID ec51ddbbe3afc1fe7308b921253d2e64fd249e67
> # Parent 0ce2cbebd74964ffe61e79de8941461bccc9371b
> # Available At https://bitbucket.org/quark-zju/hg-draft
> # hg pull https://bitbucket.org/quark-zju/hg-draft -r ec51ddbbe3af
> 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.
Thanks! That's a great description. Queued.
>
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> --- a/hgext/shelve.py
> +++ b/hgext/shelve.py
> @@ -317,5 +317,5 @@ def getshelvename(repo, parent, opts):
> 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')
> @@ -344,6 +344,4 @@ def getshelvename(repo, parent, opts):
> name = n
> break
> - else:
> - raise error.Abort(_("too many shelved changes named '%s'") % label)
>
> return name
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list