[PATCH] shelve: adds restoring newly created branch (issue5048)
Piotr Listkiewicz
piotr.listkiewicz at gmail.com
Tue Feb 23 14:49:54 UTC 2016
>
> You are Touching the shelve format. How did you ensure backward
> compatibility with (1) shelve created with older mercurial version (2)
> older version reading your new shelve format ?
> I can see other way that a format update to store this data. But if you
> format change does not have compatibility issue, it seems like a legit path.
Older version of mercurial will not have any problems with changes in
shelve format because new format only adds line to old format - so older
versions of mercurial will not read those lines and they will not restore
branch.
Other way around (new version of mercurial reading old version of shelve)
there is a problem because shelvedstate compares if versions are identical
with:
class shelvedstate(object):
_version = 1
_filename = 'shelvedstate'
@classmethod
def load(cls, repo):
fp = repo.vfs(cls._filename)
try:
version = int(fp.readline().strip())
if version != cls._version:
raise error.Abort(_('this version of shelve is incompatible
'
'with the version used in this repo'))
If version compability would be check with version <= cls._version there
wouldn't be any problems: for older version of format we wouldn't read
restorebranch information and we wound't be doing any branch restoring.
For now the only solution i see that wouldn't break previous compability
would be to try to read restore branch information and if it failed(with
IOError) it would assume restore branch should not take place.
I am looking forward to suggestions what to do with this problem.
>
> Could we check this before committing instead? Would that make it easier?
I have no idea how this would make it easier.
2016-02-22 16:28 GMT+01:00 Yuya Nishihara <yuya at tcha.org>:
> On Mon, 22 Feb 2016 16:13:43 +0100, Piotr Listkiewicz wrote:
> > > Can it be a single "branch-name-should-be-set" field? I feel the string
> > > 'True'
> > > is a bit ugly.
> >
> > Could you be more descriptive, i have no idea how should it be done more
> > properly.
>
> I meant it could be ''|newbranch instead of (restorebranch,
> origshelvebranch)
> pair.
>
> That said, histedit saves boolean as 'True' or 'False', so it would be okay
> to store "restorebranch" as a string if it makes things easy.
>
> > > Perhaps we'd better to say "marked working directory as branch %s"
> again.
> >
> > Just ui.write("marked working directory as branch %s" % origshelvebranch)
> > would be ok?
>
> ui.status(_(...)). See commands.branch().
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160223/232031ec/attachment-0002.html>
More information about the Mercurial-devel
mailing list