git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] allow file list editing during cg-commit
@ 2005-05-09  4:14 Eugene Surovegin
  2005-05-09  8:27 ` Marcel Holtmann
  2005-05-09 15:24 ` Jonas Fonseca
  0 siblings, 2 replies; 6+ messages in thread
From: Eugene Surovegin @ 2005-05-09  4:14 UTC (permalink / raw)
  To: git

Hi!

I just started playing with cogito and failed to find _easy_ way to
select which files will be committed and which won't. cg-commit seems
to support specifying file list in command line, but this isn't very
convenient when the list is big.

I tend to have many modified files in my repo, but commit them in
several different changeset.

I just made simple change to cg-commit which allows  editing file
list while editing log message; for example, if I have 30 files  ready
for commit, but want to commit only 29, I just remove this file
from "CG:" list.

Patch which demonstrates the idea follows. Please note, this is
just a quick hack, and I probably missed some cg-commit cases, when
such behavior is undesirable; also, I cheated a little to make
grepping easy :).

Signed-off-by: Eugene Surovegin <ebs@ebshome.net>

Index: cg-commit
===================================================================
--- 3974261da777f55a7a11aff6e02f584bbfe2b475/cg-commit  (mode:100755)
+++ uncommitted/cg-commit  (mode:100755)
@@ -116,7 +116,7 @@
 	for file in "${commitfiles[@]}"; do
 		# TODO: Prepend a letter describing whether it's addition,
 		# removal or update. Or call git status on those files.
-		echo "CG:    $file" >>$LOGMSG
+		echo "CG:F    $file" >>$LOGMSG
 		[ "$msgs" ] && ! [ "$forceeditor" ] && echo $file
 	done
 fi
@@ -131,6 +131,11 @@
 		rm $LOGMSG $LOGMSG2
 		die 'Commit message not modified, commit aborted'
 	fi
+	eval commitfiles=($(grep ^CG:F $LOGMSG2 | sed 's/^CG:F//'))
+	if [ ! "${commitfiles[*]}" ]; then
+		rm $LOGMSG $LOGMSG2
+		die 'Nothing to commit'
+	fi
 else
 	cat >>$LOGMSG2
 fi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] allow file list editing during cg-commit
  2005-05-09  4:14 [RFC] allow file list editing during cg-commit Eugene Surovegin
@ 2005-05-09  8:27 ` Marcel Holtmann
  2005-05-09  8:33   ` Eugene Surovegin
  2005-05-09  8:46   ` Petr Baudis
  2005-05-09 15:24 ` Jonas Fonseca
  1 sibling, 2 replies; 6+ messages in thread
From: Marcel Holtmann @ 2005-05-09  8:27 UTC (permalink / raw)
  To: Eugene Surovegin; +Cc: git

Hi Eugene,

> I just started playing with cogito and failed to find _easy_ way to
> select which files will be committed and which won't. cg-commit seems
> to support specifying file list in command line, but this isn't very
> convenient when the list is big.

do you know any SCM native text interface that supports such a thing? In
general this is done by high-level GUI based interfaces to the SCM or a
special Emacs mode etc.

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] allow file list editing during cg-commit
  2005-05-09  8:27 ` Marcel Holtmann
@ 2005-05-09  8:33   ` Eugene Surovegin
  2005-05-09  8:46   ` Petr Baudis
  1 sibling, 0 replies; 6+ messages in thread
From: Eugene Surovegin @ 2005-05-09  8:33 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: git

On Mon, May 09, 2005 at 10:27:09AM +0200, Marcel Holtmann wrote:
> Hi Eugene,
> 
> > I just started playing with cogito and failed to find _easy_ way to
> > select which files will be committed and which won't. cg-commit seems
> > to support specifying file list in command line, but this isn't very
> > convenient when the list is big.
> 
> do you know any SCM native text interface that supports such a thing? In
> general this is done by high-level GUI based interfaces to the SCM or a
> special Emacs mode etc.

Perforce works like that. This is where I "stole" this idea :)

I think cogito _is_ UI, a text one, of course.

-- 
Eugene


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] allow file list editing during cg-commit
  2005-05-09  8:27 ` Marcel Holtmann
  2005-05-09  8:33   ` Eugene Surovegin
@ 2005-05-09  8:46   ` Petr Baudis
  2005-05-09 22:24     ` Eugene Surovegin
  1 sibling, 1 reply; 6+ messages in thread
From: Petr Baudis @ 2005-05-09  8:46 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Eugene Surovegin, git

Dear diary, on Mon, May 09, 2005 at 10:27:09AM CEST, I got a letter
where Marcel Holtmann <marcel@holtmann.org> told me that...
> Hi Eugene,

Hello,

> > I just started playing with cogito and failed to find _easy_ way to
> > select which files will be committed and which won't. cg-commit seems
> > to support specifying file list in command line, but this isn't very
> > convenient when the list is big.
> 
> do you know any SCM native text interface that supports such a thing? In
> general this is done by high-level GUI based interfaces to the SCM or a
> special Emacs mode etc.

so what? I still think the idea is cool, why shouldn't support it if
noone else does?

The only thing to watch out for is that cg-commit -C produces no such
list at all; it should deal with that and tell the user he is not going
to be able to control what is going to be committed then.

Another thing is that at the moment you modify the file list, you should
set customfiles - otherwise you will commit even cg-adds and cg-rms of
files you didn't select. But do that really only when you change the
file list, since it is more expensive.

You should also place an appropriate hint near the CG: lines, saying
that removing some of them will limit the list of files to be committed.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] allow file list editing during cg-commit
  2005-05-09  4:14 [RFC] allow file list editing during cg-commit Eugene Surovegin
  2005-05-09  8:27 ` Marcel Holtmann
@ 2005-05-09 15:24 ` Jonas Fonseca
  1 sibling, 0 replies; 6+ messages in thread
From: Jonas Fonseca @ 2005-05-09 15:24 UTC (permalink / raw)
  To: git

Eugene Surovegin <ebs@ebshome.net> wrote Sun, May 08, 2005:
> I just started playing with cogito and failed to find _easy_ way to
> select which files will be committed and which won't. cg-commit seems
> to support specifying file list in command line, but this isn't very
> convenient when the list is big.

The commit message is already very self documenting so it would be great
if this feature was also documented there. Something like the following,
but clearer:

CG: -----------------------------------------------------------------
CG: Lines beginning with the CG: prefix are removed automatically.
CG: By deleting lines beginning with `CG:F' the associated file will
CG: be removed from the commit list.
CG: ...

-- 
Jonas Fonseca

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] allow file list editing during cg-commit
  2005-05-09  8:46   ` Petr Baudis
@ 2005-05-09 22:24     ` Eugene Surovegin
  0 siblings, 0 replies; 6+ messages in thread
From: Eugene Surovegin @ 2005-05-09 22:24 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

On Mon, May 09, 2005 at 10:46:06AM +0200, Petr Baudis wrote:

[snip]

> The only thing to watch out for is that cg-commit -C produces no such
> list at all; it should deal with that and tell the user he is not going
> to be able to control what is going to be committed then.
> 
> Another thing is that at the moment you modify the file list, you should
> set customfiles - otherwise you will commit even cg-adds and cg-rms of
> files you didn't select. But do that really only when you change the
> file list, since it is more expensive.
> 
> You should also place an appropriate hint near the CG: lines, saying
> that removing some of them will limit the list of files to be committed.

OK, how about the following patch? I tried to address all issues you 
mentioned and also $merging case as well.

Signed-off-by: Eugene Surovegin <ebs@ebshome.net>

Index: cg-commit
===================================================================
--- 972d8624458936868e6f392b40858b7c362af8cd/cg-commit  (mode:100755)
+++ uncommitted/cg-commit  (mode:100755)
@@ -111,12 +111,16 @@
 		rm $LOGMSG $LOGMSG2
 		die 'Nothing to commit'
 	fi
+	if [ ! "$merging" ]; then
+		echo "CG: By deleting lines beginning with CG:F the associated file" >>$LOGMSG 
+		echo "CG: will be removed from the commit list." >>$LOGMSG 
+	fi	
 	echo "CG:" >>$LOGMSG
 	echo "CG: Modified files:" >>$LOGMSG
 	for file in "${commitfiles[@]}"; do
 		# TODO: Prepend a letter describing whether it's addition,
 		# removal or update. Or call git status on those files.
-		echo "CG:    $file" >>$LOGMSG
+		echo "CG:F    $file" >>$LOGMSG
 		[ "$msgs" ] && ! [ "$forceeditor" ] && echo $file
 	done
 fi
@@ -131,6 +135,17 @@
 		rm $LOGMSG $LOGMSG2
 		die 'Commit message not modified, commit aborted'
 	fi
+	if [ ! "$ignorecache" ] && [ ! "$merging" ]; then
+		eval newcommitfiles=($(grep ^CG:F $LOGMSG2 | sed 's/^CG:F//'))
+		if [ ! "${newcommitfiles[*]}" ]; then
+			rm $LOGMSG $LOGMSG2
+			die 'Nothing to commit'
+		fi
+		if [ "${commitfiles[*]}" != "${newcommitfiles[*]}" ]; then
+			commitfiles="${newcommitfiles[*]}"
+			customfiles="${commitfiles[*]}"
+		fi
+	fi
 else
 	cat >>$LOGMSG2
 fi


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-09 22:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-09  4:14 [RFC] allow file list editing during cg-commit Eugene Surovegin
2005-05-09  8:27 ` Marcel Holtmann
2005-05-09  8:33   ` Eugene Surovegin
2005-05-09  8:46   ` Petr Baudis
2005-05-09 22:24     ` Eugene Surovegin
2005-05-09 15:24 ` Jonas Fonseca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).