tests/test-convert-mtn-rename-directory.out
author A. S. Budden <abudden@gmail.com>
Fri, 30 Mar 2012 22:08:46 +0100
changeset 16324 46b991a1f428
parent 7957 88a2687fbd38
permissions -rw-r--r--
record: allow splitting of hunks by manually editing patches It is possible that unrelated changes in a file are on sequential lines. The current record extension does not allow these to be committed independently. An example use case for this is in software development for deeply embedded real-time systems. In these environments, it is not always possible to use a debugger (due to time-constraints) and hence inline UART-based printing is often used. When fixing a bug in a module, it is often convenient to add a large number of 'printf's (linked to the UART via a custom fputc) to the module in order to work out what is going wrong. printf is a very slow function (and also variadic so somewhat frowned upon by the MISRA standard) and hence it is highly undesirable to commit these lines to the repository. If only a partial fix is implemented, however, it is desirable to commit the fix without deleting all of the printf lines. This is also simplifies removal of the printf lines as once the final fix is committed, 'hg revert' does the rest. It is likely that the printf lines will be very near the actual fix, so being able to split the hunk is very useful in this case. There were two alternatives I considered for the user interface. One was to manually edit the patch, the other to allow a hunk to be split into individual lines for consideration. The latter option would require a significant refactor of the record module and is less flexible. While the former is potentially more complicated to use, this is a feature that is likely to only be used in certain exceptional cases (such as the use case proposed above) and hence I felt that the complexity would not be a considerable issue. I've also written a follow-up patch that refactors the 'prompt' code to base everything on the choices variable. This tidies up and clarifies the code a bit (removes constructs like 'if ret == 7' and removes the 'e' option from the file scope options as it's not relevant there. It's not really a necessity, so I've excluded it from this submission for now, but I can send it separately if there's a desire and it's on bitbucket (see below) in the meantime. Possible future improvements include: * Tidying up the 'prompt' code to base everything on the choices variable. This would allow entries to be removed from the prompt as currently 'e' is offered even for entire file patches, which is currently unsupported. * Allowing the entire file (or even multi-file) patch to be edited manually: this would require quite a large refactor without much benefit, so I decided to exclude it from the initial submission. * Allow the option to retry if a patch fails to apply (this is what Git does). This would require quite a bit of refactoring given the current 'hg record' implementation, so it's debatable whether it's worth it. Output is similar to existing record user interface except that an additional option ('e') exists to allow manual editing of the patch. This opens the user's configured editor with the patch. A comment is added to the bottom of the patch explaining what to do (based on Git's one). A large proportion of the changeset is test-case changes to update the options reported by record (Ynesfdaq? instead of Ynsfdaq?). Functional changes are in record.py and there are some new test cases in test-record.t.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7957
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     1
% tedious monotone keys configuration
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     2
% create monotone repository
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     3
mtn: adding dir1 to workspace manifest
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     4
mtn: adding dir1/subdir1 to workspace manifest
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     5
mtn: adding dir1/subdir1/file1 to workspace manifest
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     6
mtn: beginning commit on branch 'com.selenic.test'
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     7
mtn: committed revision 5ed13ff5582d8d1e319f079b694a37d2b45edfc8
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     8
% rename directory
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
     9
mtn: skipping dir1, already accounted for in workspace
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    10
mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    11
mtn: beginning commit on branch 'com.selenic.test'
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    12
mtn: committed revision 985204142a822b22ee86b509d61f3c5ab6857d2b
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    13
% convert
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    14
assuming destination repo.mtn-hg
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    15
initializing destination repo.mtn-hg repository
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    16
scanning source...
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    17
sorting...
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    18
converting...
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    19
1 initialize
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    20
0 rename
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    21
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    22
% manifest
88a2687fbd38 right way to check if file was in renamed directory, fixes import monotone
Pavel Volkovitskiy <int@mtx.ru>
parents:
diff changeset
    23
dir1/subdir2/file1