##// END OF EJS Templates
dirstate: document the `changing_*` context manager...
marmoute -
r51962:a63e1f79 default
parent child Browse files
Show More
@@ -343,11 +343,52 b' class dirstate:'
343
343
344 @contextlib.contextmanager
344 @contextlib.contextmanager
345 def changing_parents(self, repo):
345 def changing_parents(self, repo):
346 """Wrap a dirstate change related to a change of working copy parents
347
348 This context scopes a series of dirstate modifications that match an
349 update of the working copy parents (typically `hg update`, `hg merge`
350 etc).
351
352 The dirstate's methods that perform this kind of modifications require
353 this context to be present before being called.
354 Such methods are decorated with `@requires_changing_parents`.
355
356 The new dirstate contents will be written to disk when the top-most
357 `changing_parents` context exits successfully. If an exception is
358 raised during a `changing_parents` context of any level, all changes
359 are invalidated. If this context is open within an open transaction,
360 the dirstate writing is delayed until that transaction is successfully
361 committed (and the dirstate is invalidated on transaction abort).
362
363 The `changing_parents` operation is mutually exclusive with the
364 `changing_files` one.
365 """
346 with self._changing(repo, CHANGE_TYPE_PARENTS) as c:
366 with self._changing(repo, CHANGE_TYPE_PARENTS) as c:
347 yield c
367 yield c
348
368
349 @contextlib.contextmanager
369 @contextlib.contextmanager
350 def changing_files(self, repo):
370 def changing_files(self, repo):
371 """Wrap a dirstate change related to the set of tracked files
372
373 This context scopes a series of dirstate modifications that change the
374 set of tracked files. (typically `hg add`, `hg remove` etc) or some
375 dirstate stored information (like `hg rename --after`) but preserve
376 the working copy parents.
377
378 The dirstate's methods that perform this kind of modifications require
379 this context to be present before being called.
380 Such methods are decorated with `@requires_changing_files`.
381
382 The new dirstate contents will be written to disk when the top-most
383 `changing_files` context exits successfully. If an exception is raised
384 during a `changing_files` context of any level, all changes are
385 invalidated. If this context is open within an open transaction, the
386 dirstate writing is delayed until that transaction is successfully
387 committed (and the dirstate is invalidated on transaction abort).
388
389 The `changing_files` operation is mutually exclusive with the
390 `changing_parents` one.
391 """
351 with self._changing(repo, CHANGE_TYPE_FILES) as c:
392 with self._changing(repo, CHANGE_TYPE_FILES) as c:
352 yield c
393 yield c
353
394
General Comments 0
You need to be logged in to leave comments. Login now