~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/commit.txt

  • Committer: Robert Collins
  • Date: 2007-06-28 06:16:19 UTC
  • mto: (2553.2.13 integration)
  • mto: This revision was merged to the branch mainline in revision 2568.
  • Revision ID: robertc@robertcollins.net-20070628061619-mds81zx3hw1dpeqm
And overhaul InterVersionedFileTestProviderAdapter too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Commit Performance Notes
2
2
========================
3
3
 
4
 
.. contents:: :local:
5
 
 
6
4
Changes to commit
7
5
-----------------
8
6
 
16
14
right, it will be relatively easy and non-disruptive to bring this in.
17
15
 
18
16
 
 
17
 
19
18
Commit: The Minimum Work Required
20
19
---------------------------------
21
20
 
174
173
     happened several commits back. There are several edge cases to be
175
174
     handled here, like if both branches modified the same file, or if
176
175
     just one branch modified it.
177
 
 
 
176
     
178
177
  b) The trickier case is when a file appears unmodified since last
179
178
     commit, but it was modified versus one of the merged branches. I
180
179
     believe there are a few ways this can happen, like if a merged
291
290
It is desirable to avoid roundtrips to the Repository during commit,
292
291
particularly because it may be remote.  If the WorkingTree can determine
293
292
by itself that a text was in the parent and therefore should be in the
294
 
Repository that avoids one roundtrip per file.
 
293
Repository that avoids one roundtrip per file.  
295
294
 
296
295
There is a possibility here that the parent revision is not stored, or not
297
296
correctly stored, in the repository the tree is being committed into, and
311
310
This creates a CommitBuilder object matched to the Branch, Repository and
312
311
Tree.  It can vary depending on model differences or by knowledge of what
313
312
is efficient with the Repository and Tree.  Model differences might
314
 
include whether no-text-change merges need to be reported, and whether the
 
313
include whether no-text-change merges need to be reported, and whether the 
315
314
 
316
 
The basic CommitBuilder.commit structure can be
 
315
The basic CommitBuilder.commit structure can be 
317
316
 
318
317
1. Ask the branch if it is ready to commit (up to date with master if
319
318
   any.)
358
357
 
359
358
* the working tree basis is up to date with the branch tip
360
359
 
361
 
* the local branch is up to date with the master branch, if there
 
360
* the local branch is up to date with the master branch, if there 
362
361
  is one and --local is not specified
363
362
 
364
 
* an empty commit message is given,
 
363
* an empty commit message is given, 
365
364
 
366
365
* a hook flags an error
367
366
 
396
395
* if there are tree references and recursing into them is enabled, then
397
396
  do so
398
397
 
399
 
Commit needs to protect against duplicated file ids
 
398
Commit needs to protect against duplicated file ids 
400
399
 
401
400
 
402
401
Updates that need to be made in the working tree, either on conclusion
429
428
* or an indication that it should be read interactively from the ui object;
430
429
* a list of files to commit
431
430
* an option for a dry-run commit
432
 
* verbose option, or callback to indicate
 
431
* verbose option, or callback to indicate 
433
432
* timestamp, timezone, committer, chosen revision id
434
433
* config (for what?)
435
434
* option for local-only commit on a bound branch
436
435
* option for strict commits (fail if there are unknown or missing files)
437
436
* option to allow "pointless" commits (with no tree changes)
438
 
 
 
437
 
439
438
(This is rather a lot of options to pass individually and just for code tidyness maybe some of them should be combine into objects.)
440
439
 
441
440
>>> Branch.commit(from_tree, message, files_to_commit, ...)
466
465
This needs to collect a list of added/changed/removed files, each of which
467
466
must have its text stored (if any) and containing directory updated.  This
468
467
can be done by calling Tree._iter_changes on the source tree, asking for
469
 
changes
 
468
changes 
470
469
 
471
470
In the 0.17 model the commit operation needs to know the per-file parents
472
 
and per-file last-changed revision.
 
471
and per-file last-changed revision.  
473
472
 
474
473
(In this and other operations we must avoid having multiple layers walk
475
474
over the tree separately.  For example, it is no good to have the Command
530
529
The main things the tree needs to tell the Branch about are:
531
530
 
532
531
* A file is modified from its parent revision (in text, permissions,
533
 
  other), and so its text may need to be stored.
534
 
 
 
532
  other), and so its text may need to be stored.  
 
533
  
535
534
  Files should also be reported if they have more than one unique parent
536
535
  revision, for repositories that store per-file graphs or last-change
537
536
  revisions.  Perhaps this behaviour should be optional.
540
539
 
541
540
* The complete contents of a modified directory, so that its inventory
542
541
  text may be stored.  This should be done after all the contained files
543
 
  and directories have been reported.  If there are unmodified files,
544
 
  or unselected files carried through from
 
542
  and directories have been reported.  If there are unmodified files, 
 
543
  or unselected files carried through from 
545
544
 
546
 
  XXX: Actually perhaps not grouped by directory, but rather grouped
547
 
  appropriately for the shape of inventory storage in the repository.
 
545
  XXX: Actually perhaps not grouped by directory, but rather grouped 
 
546
  appropriately for the shape of inventory storage in the repository. 
548
547
 
549
548
  In a zoomed-in checkout the workingtree may not have all the shape data
550
549
  for the entire tree.
577
576
This might be construed as an enhanced version of ``set_parent_trees``.
578
577
We can avoid a stat on each file by using the value that was observed when
579
578
it was first read.
580
 
 
 
579
 
581
580
 
582
581
 
583
582
Selective commit
591
590
However, the tree walking code does probably need to know about selected
592
591
paths to avoid examining unselected files or directories.
593
592
 
594
 
We never refuse selective file commits (except of merges).
 
593
We never refuse selective file commits (except of merges).  
595
594
 
596
595
 
597
596