.hgtags
author A. S. Budden <abudden@gmail.com>
Fri, 30 Mar 2012 22:08:46 +0100
branchstable
changeset 1057 66d2754c6f30
parent 200 7eae2cfd26fa
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. [ original upstream message ]
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22
bd97d6fde324 Added tag universal_scheme for changeset 536c1797202d
Christian Ebert <blacktrash@gmx.net>
parents:
diff changeset
     1
536c1797202d57efb77bea098e10968ff01602ce universal_scheme
43
fe5d9b9e78fc Added tag cvs_scheme for changeset ba000e29ecf3
Christian Ebert <blacktrash@gmx.net>
parents: 22
diff changeset
     2
ba000e29ecf3b8df09e0fd363a78cabbe3c2a78f cvs_scheme
62
736ff2dde308 Added tag r0.1 for changeset 1fe48bf82d05
Christian Ebert <blacktrash@gmx.net>
parents: 43
diff changeset
     3
1fe48bf82d056f1ece05baccab888357c10c5ab8 r0.1
91
04c899130750 Added tag very_cvs for changeset 2e930f842242
Christian Ebert <blacktrash@gmx.net>
parents: 85
diff changeset
     4
2e930f84224222ad6514a3c5dc6e00350e199e92 very_cvs
125
e09b070073b2 Added tag hgkw_standalone_setup for changeset 99dc49c5bcfb
Christian Ebert <blacktrash@gmx.net>
parents: 91
diff changeset
     5
99dc49c5bcfba9d5b412c5fa6d0bf3ba20d68df1 hgkw_standalone_setup
130
8b9912865921 Added tag nohook for changeset 15e8cd7f5295
Christian Ebert <blacktrash@gmx.net>
parents: 125
diff changeset
     6
15e8cd7f5295728b089fc8ba236c0f079572fb1d nohook
150
ba5cb61db7a0 Added tag archive for changeset 0c8b7e5c25a6
Christian Ebert <blacktrash@gmx.net>
parents: 130
diff changeset
     7
0c8b7e5c25a6b9a0d2782eaa3748eb546f5a254f archive
194
2a51062ecc60 Removed tag universal_scheme
Christian Ebert <blacktrash@gmx.net>
parents: 150
diff changeset
     8
0000000000000000000000000000000000000000 universal_scheme
195
17bd1f7ca3be Removed tag cvs_scheme
Christian Ebert <blacktrash@gmx.net>
parents: 194
diff changeset
     9
0000000000000000000000000000000000000000 cvs_scheme
196
aebd144f03f2 Removed tag r0.1
Christian Ebert <blacktrash@gmx.net>
parents: 195
diff changeset
    10
0000000000000000000000000000000000000000 r0.1
197
87f5b5365b76 Removed tag very_cvs
Christian Ebert <blacktrash@gmx.net>
parents: 196
diff changeset
    11
0000000000000000000000000000000000000000 very_cvs
198
99ab1bcffa67 Removed tag hgkw_standalone_setup
Christian Ebert <blacktrash@gmx.net>
parents: 197
diff changeset
    12
0000000000000000000000000000000000000000 hgkw_standalone_setup
199
d07c6297d4bb Removed tag nohook
Christian Ebert <blacktrash@gmx.net>
parents: 198
diff changeset
    13
0000000000000000000000000000000000000000 nohook
200
7eae2cfd26fa Removed tag archive
Christian Ebert <blacktrash@gmx.net>
parents: 199
diff changeset
    14
0000000000000000000000000000000000000000 archive