"cg-whatsnew" command
PATCH 1/1 "cg-whatsnew" command
This patch adds a simple command that shows the unmerged changes on a branch. I find it quite useful to be able to see the diff or the log before merging (gnuarch has something similar with "missing").
Catalin
Added the "cg-whatsnew" command
The command shows the unmerged changes on a branch (defaulting to "origin") as either a diff, log or patch.
---
commit e396c64c7f84c45a1360d34bcb6092b62183df7d
tree c143a31ed694000b705c5019bb10ec3b3f911344
parent fa6e9eb368e949e78c4e66217461cf624b52b0a2
author Catalin Marinas <[email protected]> Sat, 14 May 2005 11:47:52 +0100 committer Catalin Marinas <[email protected]> Sat, 14 May 2005 11:47:52 +0100
Makefile | 3 +- cg-help | 1 cg-whatsnew | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-)
Makefile (mode:100644) +2 -1
@@ -49,7 +49,8 @@ SCRIPT= commit-id tree-id parent-id cg-add cg-admin-lsobj cg-admin-uncommit \ cg-branch-add cg-branch-ls cg-cancel cg-clone cg-commit cg-diff \ cg-export cg-help cg-init cg-log cg-ls cg-merge cg-mkpatch cg-patch \ - cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update + cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update \ + cg-whatsnew LIB_SCRIPT=cg-Xlib cg-Xdiffdo cg-Xmergefile
cg-help (mode:100755) +1 -0
@@ -44,6 +44,7 @@ cg-tag-ls cg-update [BNAME] cg-version + cg-whatsnew [-n] [-l | -m] [BNAME] Advanced (low-level or dangerous) commands: cg-admin-lsobj [OBJTYPE]
cg-whatsnew (mode:100755) renamed from dev/null (tree:de641904363cd3759f132ee7c0dfaf8a2ee58388) +63 -0
63 lines not on this page · raw message
Dear diary, on Sat, May 14, 2005 at 12:58:04PM CEST, I got a letter where Catalin Marinas <[email protected]> told me that...
Quoted 3 lines
This patch adds a simple command that shows the unmerged changes on a branch. I find it quite useful to be able to see the diff or the log before merging (gnuarch has something similar with "missing").
I'd prefer this to be functionality builtin to cg-log and cg-mkpatch. Perhaps some
cg-log -m $branch2 [$branch1]
to show stuff in branch2 not yet merged to branch1.
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Quoted 6 lines · Petr Baudis
Dear diary, on Sat, May 14, 2005 at 12:58:04PM CEST, I got a letter where Catalin Marinas <[email protected]> told me that...
Quoted 3 lines
This patch adds a simple command that shows the unmerged changes on a branch. I find it quite useful to be able to see the diff or the log before merging (gnuarch has something similar with "missing").
Quoted 6 lines
I'd prefer this to be functionality builtin to cg-log and cg-mkpatch. Perhaps some
cg-log -m $branch2 [$branch1]to show stuff in branch2 not yet merged to branch1.
See the attached patch. Let me know if you want it implemented differently. I also added the "-m" option to cg-diff.
Signature · 1 line
Catalin
"-m" option added to cg-diff, cg-log and cg-mkpatch
This option takes two optional parameters, branch2 and branch1, and shows the changes in branch2 not yet merged to branch1. Branch2 defaults to origin and branch1 to HEAD.
---
commit 1a9bf2d3a0478344ae4019ac0725426627c32658
tree 3e889a5c03d7df9f82d7a649e02fef2ebdbb9f75
parent fa6e9eb368e949e78c4e66217461cf624b52b0a2
author Catalin Marinas <[email protected]> Sun, 15 May 2005 09:25:49 +0100 committer Catalin Marinas <[email protected]> Sun, 15 May 2005 09:25:49 +0100
cg-diff | 19 +++++++++++++++++++ cg-help | 6 +++--- cg-log | 19 +++++++++++++++++++ cg-mkpatch | 19 +++++++++++++++++++ 4 files changed, 60 insertions(+), 3 deletions(-)
cg-diff (mode:100755) +19 -0
@@ -14,6 +14,9 @@ # -p instead of one ID denotes a parent commit to the specified ID # (which must not be a tree, obviously). # +# -m [branch2] [branch1] shows the changes in branch2 (defaulting to +# origin) not yet merged to branch1 (defaulting to HEAD) +# # Outputs a diff converting the first tree to the second one. . ${COGITO_LIB}cg-Xlib
@@ -31,6 +34,22 @@ parent=1 fi +if [ "$1" = "-m" ]; then + branch=HEAD + id2=origin + shift + if [ "$1" ]; then + id2=$1 + shift + fi + if [ "$1" ]; then + branch=$1 + shift + fi + id1=$(git-merge-base "$branch" "$id2") + [ "$id1" ] || die "Unable to determine the merge base" +fi + if [ "$1" = "-r" ]; then shift id1=$(echo "$1": | cut -d : -f 1)
cg-help (mode:100755) +3 -3
@@ -26,14 +26,14 @@ cg-cancel cg-clone [-s] SOURCE_LOC [DESTDIR] cg-commit [-m"Commit message"]... [-e | -E] [FILE]... < log message - cg-diff [-p] [-r FROM_ID[:TO_ID]] [FILE]... + cg-diff [-p] [-r FROM_ID[:TO_ID]] [-m [BNAME] [BNAME]] [FILE]... cg-export DEST [TREE_ID] cg-help [COMMAND] cg-init - cg-log [-c] [-f] [-r FROM_ID[:TO_ID]] [FILE]... + cg-log [-c] [-f] [-r FROM_ID[:TO_ID]] ] [-m [BNAME] [BNAME]] [FILE]... cg-ls [TREE_ID] cg-merge [-c] [-b BASE_ID] FROM_ID - cg-mkpatch [-s] [-r FROM_ID[:TO_ID]] + cg-mkpatch [-s] [-r FROM_ID[:TO_ID]]] [-m [BNAME] [BNAME]] cg-patch < patch on stdin cg-pull [BNAME] cg-restore [FILE]...
cg-log (mode:100755) +19 -0
@@ -22,6 +22,9 @@ # (HEAD by default), or id1:id2 representing an (id1;id2] range # of commits to show. # +# -m [branch2] [branch1] shows the changes in branch2 (defaulting to +# origin) not yet merged to branch1 (defaulting to HEAD) +# # The rest of arguments are took as filenames; cg-log then displays # only changes in those files.
@@ -94,6 +97,22 @@ log_start= log_end= +if [ "$1" = "-m" ]; then + branch=HEAD + log_end=origin + shift + if [ "$1" ]; then + log_end=$1 + shift + fi + if [ "$1" ]; then + branch=$1 + shift + fi + log_start=$(git-merge-base "$branch" "$log_end") + [ "$log_start" ] || die "Unable to determine the merge base" +fi + if [ "$1" = "-r" ]; then shift log_start="$1"
cg-mkpatch (mode:100755) +19 -0
@@ -9,6 +9,9 @@ # # Takes an -r followed with ID defaulting to HEAD, or id1:id2, forming # a range (id1;id2]. (Use "id1:" to take just everything from id1 to HEAD.) +# +# -m [branch2] [branch1] shows the changes in branch2 (defaulting to +# origin) not yet merged to branch1 (defaulting to HEAD) . ${COGITO_LIB}cg-Xlib
@@ -65,6 +68,22 @@ log_start= log_end= +if [ "$1" = "-m" ]; then + branch=HEAD + log_end=origin + shift + if [ "$1" ]; then + log_end=$1 + shift + fi + if [ "$1" ]; then + branch=$1 + shift + fi + log_start=$(git-merge-base "$branch" "$log_end") + [ "$log_start" ] || die "Unable to determine the merge base" +fi + if [ "$1" = "-r" ]; then shift log_start="$1"
cg-help (mode:100755) line 29
Quoted 1 line · Catalin Marinas
cg-help (mode:100755) +1
-0+ cg-diff [-p] [-r FROM_ID[:TO_ID]] [-m [BNAME] [BNAME]] [FILE]...
That should be
[-m [BNAME [BNAME]]]
though I'd suggest something more mnemonic than two BNAMEs.
Signature · 1 line
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [email protected]Quoted 5 lines · Matthias Urlichs
Review
Quoted 1 line
(quoted diff) +1
-0+ cg-diff [-p] [-r FROM_ID[:TO_ID]] [-m [BNAME] [BNAME]] [FILE]...That should be
[-m [BNAME [BNAME]]]
You are right.
Quoted 1 line
though I'd suggest something more mnemonic than two BNAMEs.
Another try, see attached.
Signature · 1 line
Catalin
"-m" option added to cg-diff, cg-log and cg-mkpatch
This option takes two optional parameters, branch2 and branch1, and shows the changes in branch2 not yet merged to branch1. Branch2 defaults to origin and branch1 to HEAD.
---
commit 54c787f373557940617bca2c206c731d04c7e07b
tree d46bb25bdadb369e6cbf28ca25ffaeb4b41f7381
parent fa6e9eb368e949e78c4e66217461cf624b52b0a2
author Catalin Marinas <[email protected]> Mon, 16 May 2005 09:30:08 +0100 committer Catalin Marinas <[email protected]> Mon, 16 May 2005 09:30:08 +0100
cg-diff | 19 +++++++++++++++++++ cg-help | 8 +++++--- cg-log | 19 +++++++++++++++++++ cg-mkpatch | 19 +++++++++++++++++++ 4 files changed, 62 insertions(+), 3 deletions(-)
cg-diff (mode:100755) +19 -0
@@ -14,6 +14,9 @@ # -p instead of one ID denotes a parent commit to the specified ID # (which must not be a tree, obviously). # +# -m [branch2] [branch1] shows the changes in branch2 (defaulting to +# origin) not yet merged to branch1 (defaulting to HEAD) +# # Outputs a diff converting the first tree to the second one. . ${COGITO_LIB}cg-Xlib
@@ -31,6 +34,22 @@ parent=1 fi +if [ "$1" = "-m" ]; then + branch=HEAD + id2=origin + shift + if [ "$1" ]; then + id2=$1 + shift + fi + if [ "$1" ]; then + branch=$1 + shift + fi + id1=$(git-merge-base "$branch" "$id2") + [ "$id1" ] || die "Unable to determine the merge base" +fi + if [ "$1" = "-r" ]; then shift id1=$(echo "$1": | cut -d : -f 1)
cg-help (mode:100755) +5 -3
@@ -26,14 +26,16 @@ cg-cancel cg-clone [-s] SOURCE_LOC [DESTDIR] cg-commit [-m"Commit message"]... [-e | -E] [FILE]... < log message - cg-diff [-p] [-r FROM_ID[:TO_ID]] [FILE]... + cg-diff [-p] [-r FROM_ID[:TO_ID]] [-m [SRC_BNAME [DST_BNAME]]] \\ + [FILE]... cg-export DEST [TREE_ID] cg-help [COMMAND] cg-init - cg-log [-c] [-f] [-r FROM_ID[:TO_ID]] [FILE]... + cg-log [-c] [-f] [-r FROM_ID[:TO_ID]] ] \\ + [-m [SRC_BNAME [DST_BNAME]]] [FILE]... cg-ls [TREE_ID] cg-merge [-c] [-b BASE_ID] FROM_ID - cg-mkpatch [-s] [-r FROM_ID[:TO_ID]] + cg-mkpatch [-s] [-r FROM_ID[:TO_ID]]] [-m [SRC_BNAME [DST_BNAME]]] cg-patch < patch on stdin cg-pull [BNAME] cg-restore [FILE]...
cg-log (mode:100755) +19 -0
@@ -22,6 +22,9 @@ # (HEAD by default), or id1:id2 representing an (id1;id2] range # of commits to show. # +# -m [branch2] [branch1] shows the changes in branch2 (defaulting to +# origin) not yet merged to branch1 (defaulting to HEAD) +# # The rest of arguments are took as filenames; cg-log then displays # only changes in those files.
@@ -94,6 +97,22 @@ log_start= log_end= +if [ "$1" = "-m" ]; then + branch=HEAD + log_end=origin + shift + if [ "$1" ]; then + log_end=$1 + shift + fi + if [ "$1" ]; then + branch=$1 + shift + fi + log_start=$(git-merge-base "$branch" "$log_end") + [ "$log_start" ] || die "Unable to determine the merge base" +fi + if [ "$1" = "-r" ]; then shift log_start="$1"
cg-mkpatch (mode:100755) +19 -0
@@ -9,6 +9,9 @@ # # Takes an -r followed with ID defaulting to HEAD, or id1:id2, forming # a range (id1;id2]. (Use "id1:" to take just everything from id1 to HEAD.) +# +# -m [branch2] [branch1] shows the changes in branch2 (defaulting to +# origin) not yet merged to branch1 (defaulting to HEAD) . ${COGITO_LIB}cg-Xlib
@@ -65,6 +68,22 @@ log_start= log_end= +if [ "$1" = "-m" ]; then + branch=HEAD + log_end=origin + shift + if [ "$1" ]; then + log_end=$1 + shift + fi + if [ "$1" ]; then + branch=$1 + shift + fi + log_start=$(git-merge-base "$branch" "$log_end") + [ "$log_start" ] || die "Unable to determine the merge base" +fi + if [ "$1" = "-r" ]; then shift log_start="$1"
Dear diary, on Mon, May 16, 2005 at 10:33:44AM CEST, I got a letter where Catalin Marinas <[email protected]> told me that...
Quoted 5 lines
Quoted 4 lines · Matthias Urlichs
Review
Quoted 1 line
(quoted diff) +1
-0+ cg-diff [-p] [-r FROM_ID[:TO_ID]] [-m [BNAME] [BNAME]] [FILE]...That should be
Quoted 7 lines
Quoted 1 line
[-m [BNAME [BNAME]]]
You are right.
Quoted 1 line
though I'd suggest something more mnemonic than two BNAMEs.
Another try, see attached.
Unfortunately I can't comment on it well when it's not either in the body or as text/plain attachment.
I think the -m usage doesn't make much sense now. What about dropping branch1 and instead using what the user passed as the -r argument?
Signature · 3 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Hi,
Petr Baudis:
Quoted 2 lines
Unfortunately I can't comment on it well when it's not either in the body or as text/plain attachment.
It was a text/x-patch attachment. What's the problem? If nothing else: save it, read it in, s/^/> /. *shrug*
At least, this way there won't be any word-wrapping by overzealous email programs ...
Signature · 1 line
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [email protected]Quoted 2 lines · Petr Baudis
Unfortunately I can't comment on it well when it's not either in the body or as text/plain attachment.
It was attached as text/x-patch.
Quoted 2 lines
I think the -m usage doesn't make much sense now. What about dropping branch1 and instead using what the user passed as the -r argument?
See attached (text/plain this time).
It is also possible not to give any argument to -m and use the -r ones entirely (not implemented in the attached patch).
Signature · 1 line
Catalin
"-m" option added to cg-diff, cg-log and cg-mkpatch
This option takes a branch name as an optional parameter and shows the changes on this branch not yet merged to HEAD or to the first argument passed to "-r".
---
cg-diff (mode:100755) +15 -0
@@ -14,6 +14,9 @@ # -p instead of one ID denotes a parent commit to the specified ID # (which must not be a tree, obviously). # +# -m [branch] shows the changes in branch (defaulting to origin) +# not yet merged to HEAD (or the first argument passed to -r) +# # Outputs a diff converting the first tree to the second one. . ${COGITO_LIB}cg-Xlib
@@ -49,6 +52,18 @@ id1=$(parent-id "$id2" | head -n 1) fi +if [ "$1" = "-m" ]; then + [ "$id1" = " " ] && id1=HEAD + id2=origin + shift + if [ "$1" ]; then + id2=$1 + shift + fi + id1=$(git-merge-base "$id1" "$id2") + [ "$id1" ] || die "Unable to determine the merge base" +fi + filter= if [ "$*" ]; then
cg-help (mode:100755) +3 -3
@@ -26,14 +26,14 @@ cg-cancel cg-clone [-s] SOURCE_LOC [DESTDIR] cg-commit [-m"Commit message"]... [-e | -E] [FILE]... < log message - cg-diff [-p] [-r FROM_ID[:TO_ID]] [FILE]... + cg-diff [-p] [-r FROM_ID[:TO_ID]] [-m [BNAME]] [FILE]... cg-export DEST [TREE_ID] cg-help [COMMAND] cg-init - cg-log [-c] [-f] [-r FROM_ID[:TO_ID]] [FILE]... + cg-log [-c] [-f] [-r FROM_ID[:TO_ID]] [-m [BNAME]] [FILE]... cg-ls [TREE_ID] cg-merge [-c] [-b BASE_ID] FROM_ID - cg-mkpatch [-s] [-r FROM_ID[:TO_ID]] + cg-mkpatch [-s] [-r FROM_ID[:TO_ID]] [-m [BNAME]] cg-patch < patch on stdin cg-pull [BNAME] cg-restore [FILE]...
cg-log (mode:100755) +15 -0
@@ -22,6 +22,9 @@ # (HEAD by default), or id1:id2 representing an (id1;id2] range # of commits to show. # +# -m [branch] shows the changes in branch (defaulting to origin) +# not yet merged to HEAD (or the first argument passed to -r) +# # The rest of arguments are took as filenames; cg-log then displays # only changes in those files.
@@ -110,6 +113,18 @@ shift fi +if [ "$1" = "-m" ]; then + [ "$log_start" ] || log_start=HEAD + log_end=origin + shift + if [ "$1" ]; then + log_end=$1 + shift + fi + log_start=$(git-merge-base "$log_start" "$log_end") + [ "$log_start" ] || die "Unable to determine the merge base" +fi + if [ "$log_end" ]; then id1="$(commit-id $log_start)" || exit 1 id2="$(commit-id $log_end)" || exit 1
cg-mkpatch (mode:100755) +15 -0
@@ -9,6 +9,9 @@ # # Takes an -r followed with ID defaulting to HEAD, or id1:id2, forming # a range (id1;id2]. (Use "id1:" to take just everything from id1 to HEAD.) +# +# -m [branch] shows the changes in branch (defaulting to origin) +# not yet merged to HEAD (or the first argument passed to -r) . ${COGITO_LIB}cg-Xlib
@@ -80,6 +83,18 @@ shift fi +if [ "$1" = "-m" ]; then + [ "$log_start" ] || log_start=HEAD + log_end=origin + shift + if [ "$1" ]; then + log_end=$1 + shift + fi + log_start=$(git-merge-base "$log_start" "$log_end") + [ "$log_start" ] || die "Unable to determine the merge base" +fi + if [ "$log_end" ]; then id1=$(commit-id $log_start) || exit 1 id2=$(commit-id $log_end) || exit 1