Discussion:
[p4] How to shelve a change with one liner from CLI?
Michael Mirman
2017-02-14 17:10:14 UTC
Permalink
It can still be a one liner - with shelve -i:

p4 --field Description=test change -o | p4 shelve -i

HTH,
--
Michael Mirman
MathWorks, Inc.
3 Apple Hill Drive, Natick, MA 01760
508-647-7555
-----Original Message-----
Behalf Of mcru
Sent: Tuesday, February 14, 2017 11:45 AM
Subject: [p4] How to shelve a change with one liner from CLI?
Posted on behalf of forum user 'mcru'.
Hi - I was hoping someone may have an example of how you can shelve a
changelist
from the command line with a one liner. My problem is getting the
description
field filled out.
Is my only option to generate an entire changelist description and read it into
p4 shelve with the -i flag?
--
http://forums.perforce.com/index.php?/topic/5173-how-to-shelve-a-
change-with-one-liner-from-cli
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perf
Michael Mirman
2017-02-14 18:22:04 UTC
Permalink
If you already have a file in a pending numbered change, you can
p4 shelve -c changenumber
I am not sure what significance the file path is on that command - especially if I have multiple files in the change.

However, the numbered change needs to be created first. I can do it in a one liner like this
env P4EDITOR=/bin/true p4 --field Description=test change
but then I need to capture the change number and plug it in to the shelve command (yes, we can construct an awk getting the change number from p4 change, but it gets unnecessarily complicated IMHO).
--
Michael Mirman
MathWorks, Inc.
3 Apple Hill Drive, Natick, MA 01760
508-647-7555
-----Original Message-----
Behalf Of tkosinski
Sent: Tuesday, February 14, 2017 12:50 PM
Subject: Re: [p4] How to shelve a change with one liner from CLI?
Posted on behalf of forum user 'tkosinski'.
Alternatively, when you open it into a pending changelist (other than the
p4 shelve -c <changelist number> //path/to/file
will work.
--
http://forums.perforce.com/index.php?/topic/5173-how-to-shelve-a-
change-with-one-liner-from-cli
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/per
Michael Mirman
2017-02-14 20:02:18 UTC
Permalink
I didn’t think of creating a whole command in -F!
Thank you for the idea!
Very cool!
:-)
--
Michael Mirman
MathWorks, Inc.
3 Apple Hill Drive, Natick, MA 01760
508-647-7555
-----Original Message-----
Behalf Of Sambwise
Sent: Tuesday, February 14, 2017 1:45 PM
Subject: Re: [p4] How to shelve a change with one liner from CLI?
Posted on behalf of forum user 'Sambwise'.
[http://forums.perforce.com/index.php?app=forums&module=forums&sec
tion=findpost&pid=21156]
Post by Michael Mirman
However, the numbered change needs to be created first. I can do it in a
one liner like this
Post by Michael Mirman
env P4EDITOR=/bin/true p4 --field Description=test change
Just as a fun exercise: if you did want to first create the change and then
shelve it (just for the sake of being needlessly complicated) here's how you
p4 --field "Description=blah" change -o | p4 -F "shelve -c
%change%" change -i | p4 -x - run
--
http://forums.perforce.com/index.php?/topic/5173-how-to-shelve-a-
change-with-one-liner-from-cli
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perfo
Loading...