##// END OF EJS Templates
shelve: add minimal documentation to all functions...
Pierre-Yves David -
r19909:df54786a default
parent child Browse files
Show More
@@ -34,7 +34,9 b' command = cmdutil.command(cmdtable)'
34 34 testedwith = 'internal'
35 35
36 36 class shelvedfile(object):
37 """Handles common functions on shelve files (.hg/.files/.patch) using
37 """Helper for the file storing a single shelve
38
39 Handles common functions on shelve files (.hg/.files/.patch) using
38 40 the vfs layer"""
39 41 def __init__(self, repo, name, filetype=None):
40 42 self.repo = repo
@@ -75,7 +77,9 b' class shelvedfile(object):'
75 77 self.name)
76 78
77 79 class shelvedstate(object):
78 """Handles saving and restoring a shelved state. Ensures that different
80 """Handle persistences during unshelving operation.
81
82 Handles saving and restoring a shelved state. Ensures that different
79 83 versions of a shelved state are possible and handles them appropriate"""
80 84 _version = 1
81 85 _filename = 'shelvedstate'
@@ -116,6 +120,8 b' class shelvedstate(object):'
116 120 util.unlinkpath(repo.join(cls._filename), ignoremissing=True)
117 121
118 122 def createcmd(ui, repo, pats, opts):
123 """subcommand that create a new shelve"""
124
119 125 def publicancestors(ctx):
120 126 """Compute the heads of the public ancestors of a commit.
121 127
@@ -245,6 +251,8 b' def createcmd(ui, repo, pats, opts):'
245 251 lockmod.release(lock, wlock)
246 252
247 253 def cleanupcmd(ui, repo):
254 """subcommand that delete all shelves"""
255
248 256 wlock = None
249 257 try:
250 258 wlock = repo.wlock()
@@ -256,6 +264,7 b' def cleanupcmd(ui, repo):'
256 264 lockmod.release(wlock)
257 265
258 266 def deletecmd(ui, repo, pats):
267 """subcommand that delete a specific shelve"""
259 268 if not pats:
260 269 raise util.Abort(_('no shelved changes specified!'))
261 270 wlock = None
@@ -273,6 +282,7 b' def deletecmd(ui, repo, pats):'
273 282 lockmod.release(wlock)
274 283
275 284 def listshelves(repo):
285 """return all shelves in repo as list of (time, filename)"""
276 286 try:
277 287 names = repo.vfs.readdir('shelved')
278 288 except OSError, err:
@@ -289,6 +299,7 b' def listshelves(repo):'
289 299 return sorted(info, reverse=True)
290 300
291 301 def listcmd(ui, repo, pats, opts):
302 """subcommand that display the list of shelve"""
292 303 pats = set(pats)
293 304 width = 80
294 305 if not ui.plain():
@@ -336,15 +347,18 b' def listcmd(ui, repo, pats, opts):'
336 347 fp.close()
337 348
338 349 def readshelvedfiles(repo, basename):
350 """return the list of file touched in a shelve"""
339 351 fp = shelvedfile(repo, basename, 'files').opener()
340 352 return fp.read().split('\0')
341 353
342 354 def checkparents(repo, state):
355 """check parent while resuming an unshelve"""
343 356 if state.parents != repo.dirstate.parents():
344 357 raise util.Abort(_('working directory parents do not match unshelve '
345 358 'state'))
346 359
347 360 def unshelveabort(ui, repo, state, opts):
361 """subcommand that abort an in-progress unshelve"""
348 362 wlock = repo.wlock()
349 363 lock = None
350 364 try:
@@ -375,6 +389,7 b' def unshelveabort(ui, repo, state, opts)'
375 389 lockmod.release(lock, wlock)
376 390
377 391 def unshelvecleanup(ui, repo, name, opts):
392 """remove related file after an unshelve"""
378 393 if not opts['keep']:
379 394 for filetype in 'hg files patch'.split():
380 395 shelvedfile(repo, name, filetype).unlink()
@@ -386,6 +401,7 b' def finishmerge(ui, repo, ms, stripnodes'
386 401 shelvedstate.clear(repo)
387 402
388 403 def unshelvecontinue(ui, repo, state, opts):
404 """subcommand to continue an in-progress unshelve"""
389 405 # We're finishing off a merge. First parent is our original
390 406 # parent, second is the temporary "fake" commit we're unshelving.
391 407 wlock = repo.wlock()
General Comments 0
You need to be logged in to leave comments. Login now