Thu, 07 Jan 2021 15:24:15 -0800 shelve: open patch using new shelf class instead of open()
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 15:24:15 -0800] rev 46279
shelve: open patch using new shelf class instead of open() For some reason the existing code didn't use `shelvedfile().opener()` so here we migrate to `shelf().open_patch()` from the `open()` system call instead. Differential Revision: https://phab.mercurial-scm.org/D9706
Thu, 07 Jan 2021 14:48:57 -0800 shelve: move function for opening .patch file to new shelf class
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 14:48:57 -0800] rev 46278
shelve: move function for opening .patch file to new shelf class The `opener()` method was used specifically for the `.patch` file, and the new `Shelf` class deals with all files involved in a shelf, so I renamed the function in the process. Differential Revision: https://phab.mercurial-scm.org/D9705
Thu, 07 Jan 2021 13:57:21 -0800 shelve: move method for reading .hg to new shelf class
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 13:57:21 -0800] rev 46277
shelve: move method for reading .hg to new shelf class Differential Revision: https://phab.mercurial-scm.org/D9704
Thu, 07 Jan 2021 11:25:39 -0800 shelve: move method for writing bundle to new shelf class
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 11:25:39 -0800] rev 46276
shelve: move method for writing bundle to new shelf class Differential Revision: https://phab.mercurial-scm.org/D9703
Thu, 07 Jan 2021 11:28:41 -0800 shelve: move method for reading .shelve file to new shelf class
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 11:28:41 -0800] rev 46275
shelve: move method for reading .shelve file to new shelf class Differential Revision: https://phab.mercurial-scm.org/D9702
Thu, 07 Jan 2021 11:22:21 -0800 shelve: move method for writing .shelve to new shelf class
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 11:22:21 -0800] rev 46274
shelve: move method for writing .shelve to new shelf class Differential Revision: https://phab.mercurial-scm.org/D9701
Thu, 07 Jan 2021 11:07:21 -0800 shelve: introduce class representing a shelf
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 11:07:21 -0800] rev 46273
shelve: introduce class representing a shelf I'm about to make phase-based shelve not write `.hg` and `.patch` files. Having a class that represents a single shelf, regardless of which files it uses will help. I'm starting small with just a `.exists()` function. I plan to eventually remove the `shelvedfile` class once all functionality has been moved to the new class. By the way, I know that things you shelve are not typically themselves shelves. I still picked `Shelf` for the class because it's short (compared to e.g. `ShelvedChange`). Differential Revision: https://phab.mercurial-scm.org/D9700
Thu, 07 Jan 2021 12:26:32 -0800 shelve: raise more specific errors
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 12:26:32 -0800] rev 46272
shelve: raise more specific errors Differential Revision: https://phab.mercurial-scm.org/D9699
Thu, 07 Jan 2021 12:58:43 -0800 shelve: trust caller of shelvedfile.opener() to check that the file exists
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 12:58:43 -0800] rev 46271
shelve: trust caller of shelvedfile.opener() to check that the file exists The only place we call `shelvedfile.opener()` is when we're about to apply a bundle. The file should always exist. If it doesn't, the `.hg/` directory is corrupt and we don't provide any guarantees about supporting corrupt repos (besides, telling the user that the shelve doesn't exist when `hg shelve --list` lists it is not very helpful). Differential Revision: https://phab.mercurial-scm.org/D9698
Thu, 07 Jan 2021 12:22:39 -0800 shelve: rewrite check for unknown shelf to delete
Martin von Zweigbergk <martinvonz@google.com> [Thu, 07 Jan 2021 12:22:39 -0800] rev 46270
shelve: rewrite check for unknown shelf to delete The code would try to delete the shelf's .patch file and if that raised an exception, it would convert it to an `error.Abort`. This patch rewrites it so the check is done upfront. I find it easier to read that way. It's now clear enough that I removed the comment explaining it as well. As Joerg pointed out during review, another differences is that the old code would move a `.hg` file without its `.patch` friend to backup before it realized that the `.patch` file was missing. The new code will error out earlier and not move the `.hg` file, which seems like an improvement. That should only matter on corrupt `.hg/shelved/` directories, however. Differential Revision: https://phab.mercurial-scm.org/D9697
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 tip