Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG630af04d4ae4: shelve: fix broken backup of conflicting untracked file
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/shelve.py (3 lines) | |||
| M | tests/test-shelve2.t (12 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Feb 4 2019, 11:49 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| hg.update(repo, wctx.node()) | hg.update(repo, wctx.node()) | ||||
| files = [] | files = [] | ||||
| files.extend(shelvectx.files()) | files.extend(shelvectx.files()) | ||||
| files.extend(shelvectx.p1().files()) | files.extend(shelvectx.p1().files()) | ||||
| # revert will overwrite unknown files, so move them out of the way | # revert will overwrite unknown files, so move them out of the way | ||||
| for file in repo.status(unknown=True).unknown: | for file in repo.status(unknown=True).unknown: | ||||
| if file in files: | if file in files: | ||||
| util.rename(file, scmutil.origpath(ui, repo, file)) | util.rename(repo.wjoin(file), | ||||
| scmutil.backuppath(ui, repo, file)) | |||||
| ui.pushbuffer(True) | ui.pushbuffer(True) | ||||
| cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), | cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), | ||||
| *pathtofiles(repo, files), | *pathtofiles(repo, files), | ||||
| **{r'no_backup': True}) | **{r'no_backup': True}) | ||||
| ui.popbuffer() | ui.popbuffer() | ||||
| def restorebranch(ui, repo, branchtorestore): | def restorebranch(ui, repo, branchtorestore): | ||||
| if branchtorestore and branchtorestore != repo.dirstate.branch(): | if branchtorestore and branchtorestore != repo.dirstate.branch(): | ||||
| restores backup of unknown file to right directory | restores backup of unknown file to right directory | ||||
| $ hg shelve | $ hg shelve | ||||
| shelved as default | shelved as default | ||||
| 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | ||||
| $ echo z > e | $ echo z > e | ||||
| $ mkdir dir | $ mkdir dir | ||||
| BROKEN: should work the same as when not using --cwd | |||||
| $ hg unshelve --cwd dir | $ hg unshelve --cwd dir | ||||
| unshelving change 'default' | unshelving change 'default' | ||||
| abort: $ENOENT$ | |||||
| [255] | |||||
| $ rmdir dir | $ rmdir dir | ||||
| $ cat e | $ cat e | ||||
| e | |||||
| $ cat e.orig | |||||
| z | z | ||||
| $ test -f e.orig && cat e.orig | |||||
| [1] | |||||
| restore broken state | |||||
| $ touch d | |||||
| $ echo e > e | |||||
| $ hg add d e | |||||
| $ hg shelve --delete default | |||||
| unshelve and conflicts with tracked and untracked files | unshelve and conflicts with tracked and untracked files | ||||
| preparing: | preparing: | ||||
| $ rm -f *.orig | $ rm -f *.orig | ||||
| $ hg ci -qm 'commit stuff' | $ hg ci -qm 'commit stuff' | ||||
| $ hg phase -p null: | $ hg phase -p null: | ||||