I have some repo in perforce, I want to download only structure of folders without files, do you know how can I make this ?
Cheers
To learn about the folders/directories that are in a certain section of your Perforce repository, you can use the p4 dirs command (see http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_dirs.html).
For example,
p4 dirs //depot/*
will tell you all the top-level directories under //depot. Suppose the list that comes back is:
//depot/main
//depot/r1.0
Then you could subsequently issue:
p4 dirs //depot/main/*
and
p4 dirs //depot/r1.0/*
to learn about the next level of directories, and so forth, until you find no further child directories under the section of the repository that you are searching.
Once you have learned the correct set of directories that correspond to the current contents of your repository in Perforce, you can issue the corresponding mkdir commands to make those directories on your workstation.
Related
I'm trying to sync only the files modified in a particular change list to p4v.
Suppose in a perforce directory //demo/test I have 10 files out of which only 3 are modified as part of change list number 1234. I want only 3 files to be synced up. I have tried below options but it did not work.
p4 sync //demo/test...#1234;
This command says the files are updated but i don't see the files synced up.
p4 sync -f //demo/test...#1234;
This command is syncing all 10 files in the directory.
Use
p4 sync //demo/test...#1234,1234
or
p4 sync //demo/test...#=1234
When running tests like these, remember that 'p4 sync' won't sync a file that you already have, which is why you found the need to run 'p4 sync -f' to force the files to be sent even though the server knows you already have them. If you want to clear the server's memory of the files that you have, you can run
p4 sync //demo/test...#none
which will remove all the (p4-managed) files matching '//demo/test...' from your workspace, and then 'p4 sync' will bring them back the next time.
Oh, and since 'test' is a directory, the pattern
//demo/test/...
is preferred to
//demo/test...
since '//demo/test/...' matches only the files in the test directory, while '//demo/test...' will also match the files in the '//demo/test1', '//demo/test-and-set', and '//demo/testarossa' directories (if those should happen to exist).
I am using to track changes to some linux system files (/etc/*), I had the .git in /etc
but now I decided to move it to / as I want to track files that are outside /etc (both /etc and / are in the same filesystems...), I did that and tried to re-add the same files with:
git add $(git status | awk '/deleted/ { print "etc/"$3 } ')
But it does not appear to be working as I hoped as now the are two lists one with a list of "new files" and one with a list of "deleted files", if commit now I will lose all the history
for the files....
What would have been the correct steps?
Thanks!
Antonio
Use git subtree (installation instructions if not already installed).
Create a new repository at / and merge it with the existing one in /etc:
$ cd /
$ git init
$ git subtree --prefix etc /etc master
Ther are similar questions on SO:
My Git repository is in the wrong root directory. Can I move it? (../ intead of ./)
Moving a git repository
And there is no way of chaning directory without losing history of files.
I need to find out if file/folder is under specific source control.
The easiest way of doing this is to find some hidden folders. (this does not guaranty that partifical file is under source control, but with some probality says that this source control was used )
It's quite straightforward with SVN, GIT, as they have hidden folders.
But I can not find the same things for Perforce and ClearCase. Are there any universal way to understand what VSC is used in those paricular cases?
Perforce does not litter the drive, but keeps the info on the server. Also, files can be mapped in different structures, and mixed with non-controlled files, so it's not something you can determine by looking at the file itself.
However you can simply ask Perforce. For example, at the CLI:
P4 fstat FILENAME
Will give you info about a file if it is under source control.
If you need to script it for Perforce, there is an option (-s) that makes things easier (since the exit code of p4 doesn't indicate success or failure of the Perforce command). So, for bourne-like shells something like this should work:
if p4 -s fstat FILENAME | grep 'exit: 0' >/dev/null 2>&1 ; then
echo "Perforce knows this file"
else
echo "Perforce don't care"
fi
For ClearCase, you will find a hidden file named view.dat at the root directory of a (snapshot) view .
If the file is under M:\ (Windows) or /view/vobs (Unix), no need to look for an hidden file or directory: you know it is a dynamic view.
Another way is to execute, in the parent directory of a file:
cleartool lsview -cview.
If that directory is in a view, that command will return its name.
Similarly, i you can run a command like p4 reconcile or p4 status, and it doesn't return an error, chances are you are in a Perforce workspace.
I am rsyncing a huge (18000 files) directory, and I need use the --delete option as there is a lot of junk in the destination folder. However, the destination is under SVN revision control, so I need it to keep the .svn/ subdirectories that each directory has. I tried using the --ignore=".svn/" flag but that seems to ignore only what is on the source, and still deletes these directories on the target. Is there any way around this? Both machines are recent CentOS servers.
Thanks.
You probably want the --exclude option; --delete-excluded would allow you to do the opposite, if desired (actually delete excluded files)
In Perforce, I want to list all the files in the current directory but the result should not include the files from the subdirectories.
For example, if I have,
//depot/X/first.c
//depot/X/second.c
//depot/Y/third.c
//depot/Z/fourth.c
The result of the command, when run for //depot/X, would contain first.c and second.c only.
The command,
p4 files //depot/X/...
will list all the files so it is of no use.
I tried with other wildcards like *, but couldn't find an answer.
I think the question is: How to list all files and directories in specified directory not including the contents from sub directories.
And the command
p4 files //xxx/xxxx/"*"
p4 files //xxx/xxxx/'*'
p4 files //xxx/xxxx/*
These commands will just list the files in directory, but lost the sub directories.
If you want to get all sub directories name, you could use the p4 dirs
p4 dirs //xxx/xxxx/*
Then the sub directories will be printed in the screen.
Normally, the command would be p4 files //depot/X/*, however, it seems in your case you are using the csh shell. In that case, the * wildcard has to be quoted, e.g. p4 files //depot/X/'*'.