2011-05-24 20:17:19 +04:00
|
|
|
Create configuration
|
|
|
|
|
|
|
|
$ echo "[ui]" >> $HGRCPATH
|
|
|
|
$ echo "interactive=true" >> $HGRCPATH
|
|
|
|
|
|
|
|
help qrefresh (no record)
|
|
|
|
|
|
|
|
$ echo "[extensions]" >> $HGRCPATH
|
|
|
|
$ echo "mq=" >> $HGRCPATH
|
|
|
|
$ hg help qrefresh
|
|
|
|
hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
|
|
|
|
|
|
|
|
update the current patch
|
|
|
|
|
|
|
|
If any file patterns are provided, the refreshed patch will contain only
|
|
|
|
the modifications that match those patterns; the remaining modifications
|
|
|
|
will remain in the working directory.
|
|
|
|
|
|
|
|
If -s/--short is specified, files currently included in the patch will be
|
|
|
|
refreshed just like matched files and remain in the patch.
|
|
|
|
|
|
|
|
If -e/--edit is specified, Mercurial will start your configured editor for
|
|
|
|
you to enter a message. In case qrefresh fails, you will find a backup of
|
|
|
|
your message in ".hg/last-message.txt".
|
|
|
|
|
|
|
|
hg add/remove/copy/rename work as usual, though you might want to use git-
|
|
|
|
style patches (-g/--git or [diff] git=1) to track copies and renames. See
|
|
|
|
the diffs help topic for more information on the git diff format.
|
|
|
|
|
|
|
|
Returns 0 on success.
|
|
|
|
|
|
|
|
options:
|
|
|
|
|
2011-09-21 22:00:48 +04:00
|
|
|
-e --edit edit commit message
|
|
|
|
-g --git use git extended diff format
|
|
|
|
-s --short refresh only files already in the patch and
|
|
|
|
specified files
|
|
|
|
-U --currentuser add/update author field in patch with current user
|
|
|
|
-u --user USER add/update author field in patch with given user
|
|
|
|
-D --currentdate add/update date field in patch with current date
|
|
|
|
-d --date DATE add/update date field in patch with given date
|
|
|
|
-I --include PATTERN [+] include names matching the given patterns
|
|
|
|
-X --exclude PATTERN [+] exclude names matching the given patterns
|
|
|
|
-m --message TEXT use text as commit message
|
|
|
|
-l --logfile FILE read commit message from file
|
2011-05-24 20:17:19 +04:00
|
|
|
|
|
|
|
[+] marked option can be specified multiple times
|
|
|
|
|
help: indicate help omitting if help document is not fully displayed
Before this patch, there is no information about whether help document
is fully displayed or not.
So, some users seem to misunderstand "-v" for "hg help" just as "the
option to show list of global options": experience on "hg help -v" for
some commands not containing verbose containers may strengthen this
misunderstanding.
Such users have less opportunity for noticing omitted help document,
and this may cause insufficient understanding about Mercurial.
This patch indicates help omitting, if help document is not fully
displayed.
For command help, the message below is displayed at the end of help
output, if help document is not fully displayed:
use "hg -v help xxxx" to show more complete help and the global
options
and otherwise:
use "hg -v help xxxx" to show the global options
For topics and extensions help, the message below is displayed, only
if help document is not fully displayed:
use "hg help -v xxxx" to show more complete help
This allows users to know whether there is any omitted information or
not exactly, and can trigger "hg help -v" invocation.
This patch causes formatting help document twice, to switch messages
one for omitted help, and another for not omitted. This decreases
performance of help document formatting, but it is not mainly focused
at help command invocation, so this wouldn't become problem.
2012-10-18 05:31:15 +04:00
|
|
|
use "hg -v help qrefresh" to show the global options
|
2011-05-24 20:17:19 +04:00
|
|
|
|
|
|
|
help qrefresh (record)
|
|
|
|
|
|
|
|
$ echo "record=" >> $HGRCPATH
|
|
|
|
$ hg help qrefresh
|
|
|
|
hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...
|
|
|
|
|
|
|
|
update the current patch
|
|
|
|
|
|
|
|
If any file patterns are provided, the refreshed patch will contain only
|
|
|
|
the modifications that match those patterns; the remaining modifications
|
|
|
|
will remain in the working directory.
|
|
|
|
|
|
|
|
If -s/--short is specified, files currently included in the patch will be
|
|
|
|
refreshed just like matched files and remain in the patch.
|
|
|
|
|
|
|
|
If -e/--edit is specified, Mercurial will start your configured editor for
|
|
|
|
you to enter a message. In case qrefresh fails, you will find a backup of
|
|
|
|
your message in ".hg/last-message.txt".
|
|
|
|
|
|
|
|
hg add/remove/copy/rename work as usual, though you might want to use git-
|
|
|
|
style patches (-g/--git or [diff] git=1) to track copies and renames. See
|
|
|
|
the diffs help topic for more information on the git diff format.
|
|
|
|
|
|
|
|
Returns 0 on success.
|
|
|
|
|
|
|
|
options:
|
|
|
|
|
2011-09-21 22:00:48 +04:00
|
|
|
-e --edit edit commit message
|
|
|
|
-g --git use git extended diff format
|
|
|
|
-s --short refresh only files already in the patch and
|
|
|
|
specified files
|
|
|
|
-U --currentuser add/update author field in patch with current user
|
|
|
|
-u --user USER add/update author field in patch with given user
|
|
|
|
-D --currentdate add/update date field in patch with current date
|
|
|
|
-d --date DATE add/update date field in patch with given date
|
|
|
|
-I --include PATTERN [+] include names matching the given patterns
|
|
|
|
-X --exclude PATTERN [+] exclude names matching the given patterns
|
|
|
|
-m --message TEXT use text as commit message
|
|
|
|
-l --logfile FILE read commit message from file
|
|
|
|
-i --interactive interactively select changes to refresh
|
2011-05-24 20:17:19 +04:00
|
|
|
|
|
|
|
[+] marked option can be specified multiple times
|
|
|
|
|
help: indicate help omitting if help document is not fully displayed
Before this patch, there is no information about whether help document
is fully displayed or not.
So, some users seem to misunderstand "-v" for "hg help" just as "the
option to show list of global options": experience on "hg help -v" for
some commands not containing verbose containers may strengthen this
misunderstanding.
Such users have less opportunity for noticing omitted help document,
and this may cause insufficient understanding about Mercurial.
This patch indicates help omitting, if help document is not fully
displayed.
For command help, the message below is displayed at the end of help
output, if help document is not fully displayed:
use "hg -v help xxxx" to show more complete help and the global
options
and otherwise:
use "hg -v help xxxx" to show the global options
For topics and extensions help, the message below is displayed, only
if help document is not fully displayed:
use "hg help -v xxxx" to show more complete help
This allows users to know whether there is any omitted information or
not exactly, and can trigger "hg help -v" invocation.
This patch causes formatting help document twice, to switch messages
one for omitted help, and another for not omitted. This decreases
performance of help document formatting, but it is not mainly focused
at help command invocation, so this wouldn't become problem.
2012-10-18 05:31:15 +04:00
|
|
|
use "hg -v help qrefresh" to show the global options
|
2011-05-24 20:17:19 +04:00
|
|
|
|
|
|
|
$ hg init a
|
|
|
|
$ cd a
|
|
|
|
|
|
|
|
Base commit
|
|
|
|
|
|
|
|
$ cat > 1.txt <<EOF
|
|
|
|
> 1
|
|
|
|
> 2
|
|
|
|
> 3
|
|
|
|
> 4
|
|
|
|
> 5
|
|
|
|
> EOF
|
|
|
|
$ cat > 2.txt <<EOF
|
|
|
|
> a
|
|
|
|
> b
|
|
|
|
> c
|
|
|
|
> d
|
|
|
|
> e
|
|
|
|
> f
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ mkdir dir
|
|
|
|
$ cat > dir/a.txt <<EOF
|
|
|
|
> hello world
|
|
|
|
>
|
|
|
|
> someone
|
|
|
|
> up
|
|
|
|
> there
|
|
|
|
> loves
|
|
|
|
> me
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg add 1.txt 2.txt dir/a.txt
|
|
|
|
$ hg commit -m aaa
|
|
|
|
$ hg qnew -d '0 0' patch
|
|
|
|
|
|
|
|
Changing files
|
|
|
|
|
|
|
|
$ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
|
|
|
|
$ sed -e 's/b/b b/' 2.txt > 2.txt.new
|
|
|
|
$ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
|
|
|
|
|
|
|
|
$ mv -f 1.txt.new 1.txt
|
|
|
|
$ mv -f 2.txt.new 2.txt
|
|
|
|
$ mv -f dir/a.txt.new dir/a.txt
|
|
|
|
|
|
|
|
Whole diff
|
|
|
|
|
|
|
|
$ hg diff --nodates
|
|
|
|
diff -r ed27675cb5df 1.txt
|
|
|
|
--- a/1.txt
|
|
|
|
+++ b/1.txt
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
1
|
|
|
|
-2
|
|
|
|
+2 2
|
|
|
|
3
|
|
|
|
-4
|
|
|
|
+4 4
|
|
|
|
5
|
|
|
|
diff -r ed27675cb5df 2.txt
|
|
|
|
--- a/2.txt
|
|
|
|
+++ b/2.txt
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
a
|
|
|
|
-b
|
|
|
|
+b b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
e
|
|
|
|
diff -r ed27675cb5df dir/a.txt
|
|
|
|
--- a/dir/a.txt
|
|
|
|
+++ b/dir/a.txt
|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
-hello world
|
|
|
|
+hello world!
|
|
|
|
|
|
|
|
someone
|
|
|
|
up
|
|
|
|
|
|
|
|
partial qrefresh
|
|
|
|
|
|
|
|
$ hg qrefresh -i -d '0 0' <<EOF
|
|
|
|
> y
|
|
|
|
> y
|
|
|
|
> n
|
|
|
|
> y
|
|
|
|
> y
|
|
|
|
> n
|
|
|
|
> EOF
|
|
|
|
diff --git a/1.txt b/1.txt
|
|
|
|
2 hunks, 2 lines changed
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
examine changes to '1.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
@@ -1,3 +1,3 @@
|
|
|
|
1
|
|
|
|
-2
|
|
|
|
+2 2
|
|
|
|
3
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
record change 1/4 to '1.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
@@ -3,3 +3,3 @@
|
|
|
|
3
|
|
|
|
-4
|
|
|
|
+4 4
|
|
|
|
5
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
record change 2/4 to '1.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
diff --git a/2.txt b/2.txt
|
|
|
|
1 hunks, 1 lines changed
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
examine changes to '2.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
a
|
|
|
|
-b
|
|
|
|
+b b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
e
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
record change 3/4 to '2.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
diff --git a/dir/a.txt b/dir/a.txt
|
|
|
|
1 hunks, 1 lines changed
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
examine changes to 'dir/a.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
|
|
|
|
After partial qrefresh 'tip'
|
|
|
|
|
|
|
|
$ hg tip -p
|
|
|
|
changeset: 1:0738af1a8211
|
|
|
|
tag: patch
|
|
|
|
tag: qbase
|
|
|
|
tag: qtip
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: [mq]: patch
|
|
|
|
|
|
|
|
diff -r 1fd39ab63a33 -r 0738af1a8211 1.txt
|
|
|
|
--- a/1.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
1
|
|
|
|
-2
|
|
|
|
+2 2
|
|
|
|
3
|
|
|
|
4
|
|
|
|
5
|
|
|
|
diff -r 1fd39ab63a33 -r 0738af1a8211 2.txt
|
|
|
|
--- a/2.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
a
|
|
|
|
-b
|
|
|
|
+b b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
e
|
|
|
|
|
|
|
|
After partial qrefresh 'diff'
|
|
|
|
|
|
|
|
$ hg diff --nodates
|
|
|
|
diff -r 0738af1a8211 1.txt
|
|
|
|
--- a/1.txt
|
|
|
|
+++ b/1.txt
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
1
|
|
|
|
2 2
|
|
|
|
3
|
|
|
|
-4
|
|
|
|
+4 4
|
|
|
|
5
|
|
|
|
diff -r 0738af1a8211 dir/a.txt
|
|
|
|
--- a/dir/a.txt
|
|
|
|
+++ b/dir/a.txt
|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
-hello world
|
|
|
|
+hello world!
|
|
|
|
|
|
|
|
someone
|
|
|
|
up
|
|
|
|
|
|
|
|
qrefresh interactively everything else
|
|
|
|
|
|
|
|
$ hg qrefresh -i -d '0 0' <<EOF
|
|
|
|
> y
|
|
|
|
> y
|
|
|
|
> y
|
|
|
|
> y
|
|
|
|
> EOF
|
|
|
|
diff --git a/1.txt b/1.txt
|
|
|
|
1 hunks, 1 lines changed
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
examine changes to '1.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
1
|
|
|
|
2 2
|
|
|
|
3
|
|
|
|
-4
|
|
|
|
+4 4
|
|
|
|
5
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
record change 1/2 to '1.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
diff --git a/dir/a.txt b/dir/a.txt
|
|
|
|
1 hunks, 1 lines changed
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
examine changes to 'dir/a.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
-hello world
|
|
|
|
+hello world!
|
|
|
|
|
|
|
|
someone
|
|
|
|
up
|
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.
2012-03-31 01:08:46 +04:00
|
|
|
record change 2/2 to 'dir/a.txt'? [Ynesfdaq?]
|
2011-05-24 20:17:19 +04:00
|
|
|
|
|
|
|
After final qrefresh 'tip'
|
|
|
|
|
|
|
|
$ hg tip -p
|
|
|
|
changeset: 1:2c3f66afeed9
|
|
|
|
tag: patch
|
|
|
|
tag: qbase
|
|
|
|
tag: qtip
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: [mq]: patch
|
|
|
|
|
|
|
|
diff -r 1fd39ab63a33 -r 2c3f66afeed9 1.txt
|
|
|
|
--- a/1.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
1
|
|
|
|
-2
|
|
|
|
+2 2
|
|
|
|
3
|
|
|
|
-4
|
|
|
|
+4 4
|
|
|
|
5
|
|
|
|
diff -r 1fd39ab63a33 -r 2c3f66afeed9 2.txt
|
|
|
|
--- a/2.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
a
|
|
|
|
-b
|
|
|
|
+b b
|
|
|
|
c
|
|
|
|
d
|
|
|
|
e
|
|
|
|
diff -r 1fd39ab63a33 -r 2c3f66afeed9 dir/a.txt
|
|
|
|
--- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
-hello world
|
|
|
|
+hello world!
|
|
|
|
|
|
|
|
someone
|
|
|
|
up
|
|
|
|
|
|
|
|
|
|
|
|
After qrefresh 'diff'
|
|
|
|
|
|
|
|
$ hg diff --nodates
|
2012-06-11 03:40:51 +04:00
|
|
|
|
|
|
|
$ cd ..
|