Show More
@@ -77,10 +77,11 b' class shelvedfile(object):' | |||||
77 | self.name) |
|
77 | self.name) | |
78 |
|
78 | |||
79 | class shelvedstate(object): |
|
79 | class shelvedstate(object): | |
80 |
"""Handle persistence |
|
80 | """Handle persistence during unshelving operations. | |
81 |
|
81 | |||
82 | Handles saving and restoring a shelved state. Ensures that different |
|
82 | Handles saving and restoring a shelved state. Ensures that different | |
83 |
versions of a shelved state are possible and handles them appropriate |
|
83 | versions of a shelved state are possible and handles them appropriately. | |
|
84 | """ | |||
84 | _version = 1 |
|
85 | _version = 1 | |
85 | _filename = 'shelvedstate' |
|
86 | _filename = 'shelvedstate' | |
86 |
|
87 | |||
@@ -120,7 +121,7 b' class shelvedstate(object):' | |||||
120 | util.unlinkpath(repo.join(cls._filename), ignoremissing=True) |
|
121 | util.unlinkpath(repo.join(cls._filename), ignoremissing=True) | |
121 |
|
122 | |||
122 | def createcmd(ui, repo, pats, opts): |
|
123 | def createcmd(ui, repo, pats, opts): | |
123 | """subcommand that create a new shelve""" |
|
124 | """subcommand that creates a new shelve""" | |
124 |
|
125 | |||
125 | def publicancestors(ctx): |
|
126 | def publicancestors(ctx): | |
126 | """Compute the heads of the public ancestors of a commit. |
|
127 | """Compute the heads of the public ancestors of a commit. | |
@@ -251,7 +252,7 b' def createcmd(ui, repo, pats, opts):' | |||||
251 | lockmod.release(lock, wlock) |
|
252 | lockmod.release(lock, wlock) | |
252 |
|
253 | |||
253 | def cleanupcmd(ui, repo): |
|
254 | def cleanupcmd(ui, repo): | |
254 | """subcommand that delete all shelves""" |
|
255 | """subcommand that deletes all shelves""" | |
255 |
|
256 | |||
256 | wlock = None |
|
257 | wlock = None | |
257 | try: |
|
258 | try: | |
@@ -264,7 +265,7 b' def cleanupcmd(ui, repo):' | |||||
264 | lockmod.release(wlock) |
|
265 | lockmod.release(wlock) | |
265 |
|
266 | |||
266 | def deletecmd(ui, repo, pats): |
|
267 | def deletecmd(ui, repo, pats): | |
267 | """subcommand that delete a specific shelve""" |
|
268 | """subcommand that deletes a specific shelve""" | |
268 | if not pats: |
|
269 | if not pats: | |
269 | raise util.Abort(_('no shelved changes specified!')) |
|
270 | raise util.Abort(_('no shelved changes specified!')) | |
270 | wlock = None |
|
271 | wlock = None | |
@@ -282,7 +283,7 b' def deletecmd(ui, repo, pats):' | |||||
282 | lockmod.release(wlock) |
|
283 | lockmod.release(wlock) | |
283 |
|
284 | |||
284 | def listshelves(repo): |
|
285 | def listshelves(repo): | |
285 |
"""return all shelves in repo as list of |
|
286 | """return all shelves in repo as list of (time, filename)""" | |
286 | try: |
|
287 | try: | |
287 | names = repo.vfs.readdir('shelved') |
|
288 | names = repo.vfs.readdir('shelved') | |
288 | except OSError, err: |
|
289 | except OSError, err: | |
@@ -299,7 +300,7 b' def listshelves(repo):' | |||||
299 | return sorted(info, reverse=True) |
|
300 | return sorted(info, reverse=True) | |
300 |
|
301 | |||
301 | def listcmd(ui, repo, pats, opts): |
|
302 | def listcmd(ui, repo, pats, opts): | |
302 | """subcommand that display the list of shelve""" |
|
303 | """subcommand that displays the list of shelves""" | |
303 | pats = set(pats) |
|
304 | pats = set(pats) | |
304 | width = 80 |
|
305 | width = 80 | |
305 | if not ui.plain(): |
|
306 | if not ui.plain(): | |
@@ -347,7 +348,7 b' def listcmd(ui, repo, pats, opts):' | |||||
347 | fp.close() |
|
348 | fp.close() | |
348 |
|
349 | |||
349 | def readshelvedfiles(repo, basename): |
|
350 | def readshelvedfiles(repo, basename): | |
350 | """return the list of file touched in a shelve""" |
|
351 | """return the list of files touched in a shelve""" | |
351 | fp = shelvedfile(repo, basename, 'files').opener() |
|
352 | fp = shelvedfile(repo, basename, 'files').opener() | |
352 | return fp.read().split('\0') |
|
353 | return fp.read().split('\0') | |
353 |
|
354 | |||
@@ -389,7 +390,7 b' def unshelveabort(ui, repo, state, opts)' | |||||
389 | lockmod.release(lock, wlock) |
|
390 | lockmod.release(lock, wlock) | |
390 |
|
391 | |||
391 | def unshelvecleanup(ui, repo, name, opts): |
|
392 | def unshelvecleanup(ui, repo, name, opts): | |
392 | """remove related file after an unshelve""" |
|
393 | """remove related files after an unshelve""" | |
393 | if not opts['keep']: |
|
394 | if not opts['keep']: | |
394 | for filetype in 'hg files patch'.split(): |
|
395 | for filetype in 'hg files patch'.split(): | |
395 | shelvedfile(repo, name, filetype).unlink() |
|
396 | shelvedfile(repo, name, filetype).unlink() |
General Comments 0
You need to be logged in to leave comments.
Login now