Skip to content
Snippets Groups Projects
Commit da121c9d authored by Boris Feld's avatar Boris Feld
Browse files

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.
parent 3cd977d5
No related branches found
No related tags found
No related merge requests found
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
backupdir = 'shelve-backup' backupdir = 'shelve-backup'
shelvedir = 'shelved' shelvedir = 'shelved'
shelvefileextensions = ['hg', 'patch'] shelvefileextensions = ['hg', 'patch', 'shelve']
# universal extension is present in all types of shelves # universal extension is present in all types of shelves
patchextension = 'patch' patchextension = 'patch'
...@@ -409,6 +409,8 @@ ...@@ -409,6 +409,8 @@
ui.status(_("nothing changed\n")) ui.status(_("nothing changed\n"))
def _shelvecreatedcommit(repo, node, name): def _shelvecreatedcommit(repo, node, name):
info = {'node': nodemod.hex(node)}
shelvedfile(repo, name, 'shelve').writeinfo(info)
bases = list(mutableancestors(repo[node])) bases = list(mutableancestors(repo[node]))
shelvedfile(repo, name, 'hg').writebundle(bases, node) shelvedfile(repo, name, 'hg').writebundle(bases, node)
with shelvedfile(repo, name, patchextension).opener('wb') as fp: with shelvedfile(repo, name, patchextension).opener('wb') as fp:
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
$ ls .hg/shelve-backup $ ls .hg/shelve-backup
default.hg default.hg
default.patch default.patch
default.shelve
checks to make sure we dont create a directory or checks to make sure we dont create a directory or
hidden file while choosing a new shelve name hidden file while choosing a new shelve name
...@@ -206,5 +207,6 @@ ...@@ -206,5 +207,6 @@
$ ls .hg/shelve-backup/ $ ls .hg/shelve-backup/
default-1.hg default-1.hg
default-1.patch default-1.patch
default-1.shelve
default.hg default.hg
default.patch default.patch
...@@ -209,5 +211,6 @@ ...@@ -209,5 +211,6 @@
default.hg default.hg
default.patch default.patch
default.shelve
local edits should not prevent a shelved change from applying local edits should not prevent a shelved change from applying
...@@ -250,5 +253,6 @@ ...@@ -250,5 +253,6 @@
$ ls .hg/shelve-backup/ $ ls .hg/shelve-backup/
default-01.hg default-01.hg
default-01.patch default-01.patch
default-01.shelve
default-1.hg default-1.hg
default-1.patch default-1.patch
...@@ -253,4 +257,5 @@ ...@@ -253,4 +257,5 @@
default-1.hg default-1.hg
default-1.patch default-1.patch
default-1.shelve
default.hg default.hg
default.patch default.patch
...@@ -255,5 +260,6 @@ ...@@ -255,5 +260,6 @@
default.hg default.hg
default.patch default.patch
default.shelve
$ hg unshelve $ hg unshelve
abort: no shelved changes to apply! abort: no shelved changes to apply!
...@@ -314,5 +320,6 @@ ...@@ -314,5 +320,6 @@
$ ls .hg/shelve-backup/ $ ls .hg/shelve-backup/
default-01.hg default-01.hg
default-01.patch default-01.patch
default-01.shelve
wibble.hg wibble.hg
wibble.patch wibble.patch
...@@ -317,5 +324,6 @@ ...@@ -317,5 +324,6 @@
wibble.hg wibble.hg
wibble.patch wibble.patch
wibble.shelve
cause unshelving to result in a merge with 'a' conflicting cause unshelving to result in a merge with 'a' conflicting
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment