# HG changeset patch # User Boris Feld # Date 1527587252 -7200 # Node ID da121c9dc0f27f0752814cd57db1ee840775cf49 # Parent 3cd977d5a16be12da19037d44f6468e4709007af 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. diff -r 3cd977d5a16b -r da121c9dc0f2 hgext/shelve.py --- 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: diff -r 3cd977d5a16b -r da121c9dc0f2 tests/test-shelve.t --- 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