Show More
@@ -159,6 +159,8 b' class shelvedstate(object):' | |||
|
159 | 159 | """ |
|
160 | 160 | _version = 1 |
|
161 | 161 | _filename = 'shelvedstate' |
|
162 | _keep = 'keep' | |
|
163 | _nokeep = 'nokeep' | |
|
162 | 164 | |
|
163 | 165 | @classmethod |
|
164 | 166 | def load(cls, repo): |
@@ -175,6 +177,7 b' class shelvedstate(object):' | |||
|
175 | 177 | parents = [nodemod.bin(h) for h in fp.readline().split()] |
|
176 | 178 | stripnodes = [nodemod.bin(h) for h in fp.readline().split()] |
|
177 | 179 | branchtorestore = fp.readline().strip() |
|
180 | keep = fp.readline().strip() == cls._keep | |
|
178 | 181 | except (ValueError, TypeError) as err: |
|
179 | 182 | raise error.CorruptedState(str(err)) |
|
180 | 183 | finally: |
@@ -188,6 +191,7 b' class shelvedstate(object):' | |||
|
188 | 191 | obj.parents = parents |
|
189 | 192 | obj.stripnodes = stripnodes |
|
190 | 193 | obj.branchtorestore = branchtorestore |
|
194 | obj.keep = keep | |
|
191 | 195 | except error.RepoLookupError as err: |
|
192 | 196 | raise error.CorruptedState(str(err)) |
|
193 | 197 | |
@@ -195,7 +199,7 b' class shelvedstate(object):' | |||
|
195 | 199 | |
|
196 | 200 | @classmethod |
|
197 | 201 | def save(cls, repo, name, originalwctx, pendingctx, stripnodes, |
|
198 | branchtorestore): | |
|
202 | branchtorestore, keep=False): | |
|
199 | 203 | fp = repo.vfs(cls._filename, 'wb') |
|
200 | 204 | fp.write('%i\n' % cls._version) |
|
201 | 205 | fp.write('%s\n' % name) |
@@ -206,6 +210,7 b' class shelvedstate(object):' | |||
|
206 | 210 | fp.write('%s\n' % |
|
207 | 211 | ' '.join([nodemod.hex(n) for n in stripnodes])) |
|
208 | 212 | fp.write('%s\n' % branchtorestore) |
|
213 | fp.write('%s\n' % (cls._keep if keep else cls._nokeep)) | |
|
209 | 214 | fp.close() |
|
210 | 215 | |
|
211 | 216 | @classmethod |
@@ -680,7 +685,7 b' def _rebaserestoredcommit(ui, repo, opts' | |||
|
680 | 685 | stripnodes = [repo.changelog.node(rev) |
|
681 | 686 | for rev in xrange(oldtiprev, len(repo))] |
|
682 | 687 | shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes, |
|
683 | branchtorestore) | |
|
688 | branchtorestore, opts.get('keep')) | |
|
684 | 689 | |
|
685 | 690 | util.rename(repo.join('rebasestate'), |
|
686 | 691 | repo.join('unshelverebasestate')) |
@@ -782,6 +787,8 b' def _dounshelve(ui, repo, *shelved, **op' | |||
|
782 | 787 | |
|
783 | 788 | try: |
|
784 | 789 | state = shelvedstate.load(repo) |
|
790 | if opts.get('keep') is None: | |
|
791 | opts['keep'] = state.keep | |
|
785 | 792 | except IOError as err: |
|
786 | 793 | if err.errno != errno.ENOENT: |
|
787 | 794 | raise |
@@ -1622,3 +1622,31 b' progress' | |||
|
1622 | 1622 | abort: no unshelve in progress |
|
1623 | 1623 | [255] |
|
1624 | 1624 | $ cd .. |
|
1625 | ||
|
1626 | Unshelve respects --keep even if user intervention is needed | |
|
1627 | $ hg init unshelvekeep | |
|
1628 | $ echo 1 > file && hg ci -Am 1 | |
|
1629 | adding file | |
|
1630 | $ echo 2 >> file | |
|
1631 | $ hg shelve | |
|
1632 | shelved as default | |
|
1633 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
1634 | $ echo 3 >> file && hg ci -Am 13 | |
|
1635 | $ hg shelve --list | |
|
1636 | default (1s ago) changes to: 1 | |
|
1637 | $ hg unshelve --keep | |
|
1638 | unshelving change 'default' | |
|
1639 | rebasing shelved changes | |
|
1640 | rebasing 3:1d24e58054c8 "changes to: 1" (tip) | |
|
1641 | merging file | |
|
1642 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |
|
1643 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
|
1644 | [1] | |
|
1645 | $ hg resolve --mark file | |
|
1646 | (no more unresolved files) | |
|
1647 | continue: hg unshelve --continue | |
|
1648 | $ hg unshelve --continue | |
|
1649 | rebasing 3:1d24e58054c8 "changes to: 1" (tip) | |
|
1650 | unshelve of 'default' complete | |
|
1651 | $ hg shelve --list | |
|
1652 | default (1s ago) changes to: 1 |
General Comments 0
You need to be logged in to leave comments.
Login now