I am trying to populate a task stream with an older revision than #head.
So I created a task stream, and did not chose to automatically branch any files.
Then I try :
>p4 populate -r -S //depot/dev //depot/main/...#some_label_vXXXX
Label 'some_label_vXXXX' is restricted to use on server 'Edge', not on server 'MASTER'.
I am connected to the edge server so I am not quite sure what is the issue there. If I need to have a global label to be able to branch, is there a way to convert an existing local to global label ?
Anyway, I try using a changelist instead.
>p4 populate -r -S //depot/dev //depot/main/...#1456175
//depot/main/...#1456175 - no target file(s) in branch view.
What happens there ? Is this an issue with the FromFile ? And what would be the proper way to populate a task stream using an existing label/changelist ?
Playing with P4V, it seems the command executed is (and this works) :
>p4 populate -o //depot/main/...#1456175 //depot/dev/...
I am still interested in understanding why the '-rS' does not work.
In this syntax:
p4 populate -r -S //depot/dev //depot/main/...#1456175
//depot/main/... is limiting the toFile, which is not what you want. This should work:
p4 populate -r -S //depot/dev #1456175
Giving the stream name already generates the fromFile->toFile view, so there's no need to specify either of them a second time.
Related
I am using the command line tools of Perforce.
And with the p4 tool, I want to sync to a stream.
The problem is that I want to exclude a directory from my workspace.
If my work space was defined as a view, this would be possible with something like:
View:
//depot/Foo/... //Client/Foo/...
-//depot/Foo...bin/... //Client/Foo...bin/...
But the Stream: setting overrides the View: specification.
I have set the Stream using the command:
$ p4 client
I also looked into P4IGNORE mechanism, but this is of no use to my problem, as P4IGNORE will not influence the sync command.
I tried adding a Paths: command to my client spec, but that is not recognized in this context. I think it is used when specifying the stream, as done by the administrator of the depot?
This is exactly what virtual streams are for. :) Create a child of the stream with type virtual, and exclude the directory from the virtual child stream (via either Paths or Ignore in the stream spec). This will generate you a client view that is the desired subset of the parent stream.
https://www.perforce.com/blog/virtual-streams-windows-big-projects
I need to merge the streams using commands in P4. can anyone help me with this? the two streams are parent child streams. I need to merge down from parent to child.
I'm typing this from memory, without actually trying it, but I think this is pretty close:
Switch your client workspace to the child stream, since that is the target of the merge: p4 client -s -S child
Sync your client, to make sure you're building and testing with the latest files: p4 sync
Merge the parent stream's changes into your child stream: p4 merge
Resolve any conflicts: p4 resolve
Build and test, to confirm that you're happy with the results
Submit the merged code to the child stream: p4 submit
Of course, make sure that you're working with the correct client workspace, as the correct user, etc., by running p4 set before you start this process, to look at your P4CLIENT, P4USER, etc. settings.
I have a file that i want to add to sourcecontrol on linux using cleartool .
I've followed the IBM documentation for this, i've tried this:
cleartool mkelem testScript.sh
I got an error: Can't modify directory "." because it is not checked out.
I also would like to know how can i checkout/checkin files or directories and setting activities.
You need to checkout the parent folder first.
cd /path/to/file/
cleartool mkact newfile
cleartool checkout -c "add file" .
cleartool mkelem testScript.sh
cleartool checkin -nc
The cleartool mkact would work if you are in an UCM view.
It will create and set a new activity, which will record the files and folder you will modify.
Here, the new activity newFile will record the new version of the parent folder, as well as the version 0 and 1 of the file.
You should create separate questions for .. separate questions...
Going back to the original - the reason why it isn't working is, as VonC has pointed out, you haven't checked out the parent of the file. Remember, when you run "cleartool mkelem", you are about to modify the contents of the parent directory (. in this case) by adding a new "pointer" to the element you're now creating. As with everything else in clearcase, when you want to modify the contents of an element, you have to check it out first.
One of ClearCase's greatest strength (and hardest to wrap one's head around) is the concept of an "element", IMO. "Everything" behaves similarly with an element. Making any change to an "element" (file or directory) means you have to check it out first to make that change.
In the case of a file, that's easy to grasp - you're just editing lines in a file. For a directory, it's almost as easy - you can think of a directory as just a list of pointers to data blobs. We make the name of the blob something convenient we can remember (like foo.java or myapplication.cc or README.md). But we can also change the name of the pointer (even though it points to the same data blob) by renaming a file. We can remove the pointer to the blob without impacting the blob itself by using "rmname". That's essentially what "rmname" does.
In ClearCases' case, the mkelem command is a little bit special - it creates the initial datablob, and adds a pointer to that datablob in the current directory (kind of does 2 things at once).
I am using following command to sync B vob files from A vob
clearfsimport -master -follow -nsetevent -comment $2 /vobs/A/xxx/*.h /vobs/B/xxx/
It works fine. But it will check in all the changes automatically. Is there a way to do the same task but leave the update files in a check out status?
I want to update the file for B from A. Build my programme, and then re-cover the branch. So if the updated files is an check out status, I can do unco later. Well with my command before, everything is checked in. I cann't re-cover my branch then.
Thanks.
As VonC said, it's impossible to prevent "clearfsimport" to do the check in. And he suggested to use a label to recover back.
For me, the branch where I did "clearfsimport" is branched from a label.Let's call it LABEL_01. So I guess I can use that label for recovery. Is there an easy way (one command) to recover the files under /vobs/B/xxx/ to label LABEL_01 ? I want to do it in my bash script, so the less/easy the command is, the better.
Thanks.
After having a look at the man page for clearfsimport, no, it isn't possible to prevent the checkins.
I would set a label before the clearfsimport, and modify the config spec for the new version to be created in a branch (similar to this config spec).
That way, "re-cover" the initial branch would be easy: none of the new version would have been created in it.
My goal is to run a bash script automatically whenever any new file is added to a particular directory or any subdirectory of that particular directory.
Detail Scenario:
I am creating an automated process for file submission from teachers to students and vice versa. Sender will upload file and it will be stored inside the Uploads directory in the LAMP server in the format, ex. "name_course-name_filename.pdf". I want some method so that when any file stored inside the Uploads folder, the same time a script will be called and send that file to the list of receives.
From the database I can find the list of receiver for that particular course and student.
The only concern of mine is, how to call a script automatically and make it work on individual file whenever the content of the directory changes. Cron will do in intervals but not a real time work.
Linux provides a nice mechanism for that purpose which is called inotify. inotify is mostly available as a C API. But there have been developed shell utilities as well. You should use inotifywait from inotifytools (pkg name in debian) for this. Here comes a basic example:
#!/bin/bash
directory="/tmp" # or whatever you are interested in
inotifywait -m -e create "$directory" |
while read folder eventlist eventfile
do
echo "the following events happened in folder $folder:"
echo "$eventlist $eventfile"
done
Update:
If the problem goes complicated, for example you'll have to monitor recursive, dynamic directory structures, you should have a look at incron It's a cron like daemon which executes scripts on certain events. But the events are file system events rather than timer events.
There is another option to 'inotifywait':
-d --daemon
Same as --monitor, except run in the background logging events to a file
that must be specified by --outfile. Implies --syslog.
For completeness:
-m --monitor
Instead of exiting after receiving a single event, execute indefinitely.
The default behaviour is to exit after the first event occurs.
Within the do-done block of your 'while' statement, you might parse each event report for interesting details then use 'case-esac' to take action based on each event that you care about.
For something that you plan to rely on for your operations, you might also consider replacing the hard-coded '$directory' with some sort of configuration file. Such a file might include the path and filename, the interesting events for that path and file, and a script to run when those events happened.
The script might take the list of events as parameters and then 'case-esac' again.
Just one man's ramblins,
~~~ 8d;-Dan