Mercurial > hg
changeset 39372:da121c9dc0f2
shelve: store shelved node in a new data file
It is useful for a version of shelve not based on bundle and strip. Having
more data does not hurt the bundle based case so we introduce it in all cases
before doing more rework.
We also keep storing the patch using another method.
note: We could have this metadata file list all the file involved in the
shelve and use that for cleanup. This would be more future proof than having a
hard-coded list of file to purge. However, this is an adventure for another
series.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 29 May 2018 11:47:32 +0200 |
parents | 3cd977d5a16b |
children | 6a71324cb68b |
files | hgext/shelve.py tests/test-shelve.t |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Sun Aug 05 16:33:30 2018 +0900 +++ b/hgext/shelve.py Tue May 29 11:47:32 2018 +0200 @@ -79,7 +79,7 @@ backupdir = 'shelve-backup' shelvedir = 'shelved' -shelvefileextensions = ['hg', 'patch'] +shelvefileextensions = ['hg', 'patch', 'shelve'] # universal extension is present in all types of shelves patchextension = 'patch' @@ -409,6 +409,8 @@ ui.status(_("nothing changed\n")) def _shelvecreatedcommit(repo, node, name): + info = {'node': nodemod.hex(node)} + shelvedfile(repo, name, 'shelve').writeinfo(info) bases = list(mutableancestors(repo[node])) shelvedfile(repo, name, 'hg').writebundle(bases, node) with shelvedfile(repo, name, patchextension).opener('wb') as fp:
--- a/tests/test-shelve.t Sun Aug 05 16:33:30 2018 +0900 +++ b/tests/test-shelve.t Tue May 29 11:47:32 2018 +0200 @@ -102,6 +102,7 @@ $ ls .hg/shelve-backup default.hg default.patch + default.shelve checks to make sure we dont create a directory or hidden file while choosing a new shelve name @@ -206,8 +207,10 @@ $ ls .hg/shelve-backup/ default-1.hg default-1.patch + default-1.shelve default.hg default.patch + default.shelve local edits should not prevent a shelved change from applying @@ -250,10 +253,13 @@ $ ls .hg/shelve-backup/ default-01.hg default-01.patch + default-01.shelve default-1.hg default-1.patch + default-1.shelve default.hg default.patch + default.shelve $ hg unshelve abort: no shelved changes to apply! @@ -314,8 +320,10 @@ $ ls .hg/shelve-backup/ default-01.hg default-01.patch + default-01.shelve wibble.hg wibble.patch + wibble.shelve cause unshelving to result in a merge with 'a' conflicting