I have a perforce sandbox, and I have created a new changeset in the sandbox, which is still pending, i.e. I have not submitted it yet. How do I obtain the changeset number. p4 changelists gives me changelists for all sandboxes, I only need for mine, and that only the pending one.
p4 changes -c CLIENT -s pending
where CLIENT is the name of your client spec ("sandbox").
From "p4 help changes":
changes -- Display list of pending and submitted changelists
changelists -- synonym for 'changes'
p4 changes [-i -t -l -L -f] [-c client] [ -e changelist# ]
[-m max] [-s status] [-u user] [file[revRange] ...]
...
The -c client flag displays only submitted by the specified client.
...
The -s status flag limits the output to changelists with the specified
status. Specify '-s pending', '-s shelved', or '-s submitted'.
Related
I am quite new to P4 and being a junior dev I am having some issues when trying to automate merges from streams, I am running p4 merge, and then p4 resolve -am, then I build the project and run some tests and if everything goes well I want to submit otherwise shelve the files so a engineer can go through the conflicts, and manually resolve them and submit. The thing is that the p4 shelve command as far as I know needs to have -c <CL#> argument, and I do not know how or where I can get the CL number I just generated when running the script. Is there any way to do this? or any documentation that can help me with this?
The shelve command does not require a -c argument.
C:\Perforce\test\python>p4 help shelve
shelve -- Store files from a pending changelist into the depot
p4 shelve [-Af] [-p] [files]
p4 shelve [-Af] [-a option] [-p] -i [-f | -r]
p4 shelve [-Af] [-a option] [-p] -r -c changelist#
p4 shelve [-Af] [-a option] [-p] -c changelist# [-f] [file ...]
p4 shelve [-As] -d -c changelist# [-f] [file ...]
...
By default, 'p4 shelve' creates a changelist, adds files from the
user's default changelist, then shelves those files in the depot.
If you just ran p4 merge and p4 resolve -am, the files are open in your default changelist. Running p4 shelve with no arguments will automatically create a new changelist out of those files and shelve it, and it will display the number of the new changelist, so all your script needs to do is print the result of the command.
How can I get the perforce root directory path. I've searched online and I've tried solution such as
p4 -F %clientRoot% -ztag info
However the results returned were empty, but when i run this command:
p4 clients -u jmartini
I get these results:
Client jma_HP001 2017/10/19 root C:\projects\john 'Created by
jmartini. '
How can I simply just get the root directory path from command line. I would expect my results to be this:
C:\projects\john
If p4 info doesn't return the current client root, your shell does not have P4CLIENT set correctly. To fix this, you can do:
p4 set P4CLIENT=jma_HP001
From this point on, other commands (including the p4 -F %clientRoot% -ztag info you tried to run first) will return results relative to that client workspace.
If you want to just get the client root out of the clients command you can do:
p4 -F %domainMount% clients -u jmartini
or:
p4 -Ztag -F %Root% clients -u jmartini
Note that if the user owns multiple clients this will get you multiple lines of output.
To figure out the formatting variables you can use with the -F flag, try running commands with the -e or -Ztag global options:
p4 -e clients -u jmartini
p4 -Ztag clients -u jmartini
More on the -F flag in this blog article: https://www.perforce.com/blog/fun-formatting
How can I source the branch name from node ID in Mercurial?
I have tried hg id nodeid but that doesn't work
But hd id nodeid does work, provided you spell the node identifier with the -r or --rev option:
$ hg id -r 2
db6f6e1d8715 (sidebr) tip
Note that if the branch name is default it is suppressed, as usual.
To get just the branch name, and avoid suppressing the name default, add the -b option:
$ hg id -b -r 1
default
Note that you can get more than one piece of information:
$ hg id -i -b -n -r 1
d05b1df8b8f6 1 default
(The order is always hash, rev, branch when using these options, regardless of the order of the -i / --id, -n / --num, and -b / --branch options. Adding -t / --tags and/or -B / --bookmarks adds the tags and the bookmarks in that order, again regardless of option order.)
I have an old branch on cvs called myapp_release_7
after I deployed that branch, I modified the trunk code and I created a new release branch
myapp_release_8
the release 8 contains new files (java new classes)
While I am deploying to test environment, I submitted this command
cvs -d {server} update -C -P -d -r "myapp_release_8"
it worked fine.
But I wanted to rollback so I submitted this command
cvs -d {server} update -C -P -d -r "myapp_release_7"
but the new files that were added by release 8 didn't get deleted after this command.
any idea why ?
How can I get list of files that were affected by specific user in the specified branch?
Regards, Evgeniy
This gets you a list of all files modified by user X on branch Y:
hg log --branch Y --user X --template '{join(files, "\n")}\n'
but it will have duplicate entries for files modified, added, or removed in multiple changesets on that branch. To consolidate them (on a unix-like you'd do):
hg log --branch Y --user X --template '{join(files, "\n")}\n'| sort -u
Update
If your Mercurial is to old for that fancy template to work you can probably do the same with this (if you're on a unix-like):
hg log --branch Y --user X --template '{files}\n' | tr ' ' '\n' | sort -u