Is it possible to create a Drupal project patch using diff, but not using Git - diff

I am trying to create a patch file by comparing Drupal projects on a project level, not on the individual file level, by using the Unix terminal command 'diff'.
Here is the syntax:
diff drupalprojectv1 drupalprojectv2 > patch.patch
When I view the patch file, all I see is the differences between the directories and subdirectories, changes in codes in individual files are not compared. If I do it with individual files, such as
diff somefile1.html.twig somefile2.html.twig > patch.patch
then I can see the difference and the patch can be applied successfully.
Is there any way a patch file can be created on a project level, instead of just between individual files without using Git?

Try
diff -ruN drupalprojectv1 drupalprojectv2 > patch.patch
Refer to diff examples and documentation for more details

Related

Avoid Git to do any merge to a certain filetype

I am working on a quite big project versioned on a Git repositories that have several file of different types versioned. Among those, we use the QM Modelling tool that uses .qm files, which are actually xml files with a certain structure.
The structure of the .qm and the meaning of its content makes it unadvisable to use a merging tool to merge any change.
What I would like to do is have git issue a conflict in case it finds changes to any qm file even if it could merge those changes ( even if it could, the result is not guaranteed to be meaningful ), so that I can manually merge them using the tool.
Pros if the same is true if I perform a rebase instead of a merge.
Ok, answering myself as I found a solution.
I found this answer and modified it a little bit. I added a new merge strategy that basically takes the file as it is in the incoming branch and uses it untouched, then marks the file as with conflict.
So i created this script:
#!/bin/bash
# ${1} is the base common file
# ${2} is the file as modified by the base branch, and where the results must be
# ${3} is the file as modified by the incoming branch
# ${4} is the path of the file being merged
# ${4%.qm*} is the path without extension
# ${4##*.} is the extension of the path
# makes a backup of the original file to ease edits comparison
cat "${2}" > "${4%.qm*}.bk.${4##*.}"
cat "${3}" > "${2}"
exit 1
which uses the incoming file as a result as it is, and returns 1 to mark it as conflict.
Then I added in the .gitattributes the option to use this strategy for my .qm file, so that when I merge two branches, I take the incoming version as it is and use the graphical tool to modify and integrate my changes.
I'm going to leave this question as unresolved to see if anybody got another solution that would enable me to use both rebase and merge.
EDIT: I updated the script, I added a few lines to take the version of the local branch and make a backup of it, so that it is available to use in a comparison tool to identify my changes more easily.

Is it possible to upload previous changes when using a VCS?

I'm using git as a VCS and I got several commits in a project. I'd like to upload every change made after a specific commit that is not the latest. Currently, if I want to do this, I have to upload practically every file in my project, or manually search for the modified files after a certain date. Both options are kinda tedious.
Is there an option that helps finding the modified files from a certain commit? Or possibly a combination of searching and selecting the files modified in a given range?
Use git log -n 1 --name-only <revision> to get files modified within a specific revision, or git diff --name-only <revision_1> <revision_2> for files that were changed between two particular revisions.

Perforce - create patch file of differences against have revision

In Perforce, how can I create a patch file which has the changes that are in the file as currently saved, compared to the have revision? Instructions for either the GUI client or the CLI client would be great.
I can see how to get the diffs between two changelists, but not how to just get the difference between the last changelist and the current state of the files. Additionally, I can see that in the GUI client, I can right-click on a file and select "Diff Against Have Revision" from the contextual menu, which shows me what I'm looking for, but I can't figure out how to get that into a file.
I'm basically looking for the equivalent of what git diff <file> > patch.diff does in Git-land.
I think that p4 diff -du FILE > patch.diff should do what you want.
Single file
p4 diff -du file > file.patch.diff
Every file
p4 diff -du > patch.diff
The problem with p4 diff is that it doesn't take into account of new files. Also you can't get files that are only in a certain pending change list.
If there is a pending changelist, you can actually use an open source perforce patcher tool, which I have created for my project needs. You can directly download from this link of github.
In case you want to checkout the source, go to the github repo.
Documentation for the tool can be found here.

Graphical diff viewer between local and repo file

Here is my use case.
I want to compare a local file i am working on with a repo file using a diff viewer.
For example
file 1 : /path-to-local-file-in-my-computer
file 2 : http://core.svn.wordpress.org/trunk/wp-load.php
Is there any program that can compare a file in my machine and a repo file in the internet??
I want to edit, revert changes line by line comparing to files. Some thing like phpstorm diff viewer?
If the local file is not a check-out of the online repository, it think your only option will be to download the online repository, select both your 'own' version and the downloaded version and compare them with the compare function of PhpStorm (ctrl+D or cmd+D on OS X)
PhpStorm also allows you to compare two directories (including their subdirectories). Here's a recent blog post describing this feature:
http://blog.jetbrains.com/webide/2013/02/comparing-files-and-folders-within-your-ide/
If you intend only to edit the file on your computer, ECMerge (our tool) can do that. Just open a 2-way merge, select the local file in left pane and set is as output, the web file in the right pane. Select what is OK (differences are highlighted and can be selected, then further modified in the result pane). Saving will update your left file on disk, and you can refresh to continue.

cvs editors does not work from many places in the same project

I am using cvs for a project. I check out a copy of the project from the repository using cvs checkout ... and then use cvs edit <file> for editing them. Now, consider the sample directory structure for my project below:
project/:
dir1/:
sample1.C
dir2/:
sample2.C
Now assume that I run the following commands:
cd ~/cvs/project/dir1/
cvs edit sample1.C
cd ../dir2
cvs edit sample2.C
cvs editors
My output will contain only sample2.C and no mention of sample1.C. If I cd into dir1 I can see only sample1.C as being edited. My questions are as follows:
Is there something wrong with my cvs settings? Or should I invoke the cvs edit command from a single place for whatever file I need to edit in order to see all the files being edited in one place.
Is there a command in cvs which I can use to see all the files being edited in cvs across projects?
P.S: Please let me know in case more details are needed.
cvs commands by default work on the current directory and below. So in your example, because you are in dir2, you are only see sample2.C. If you moved back up to the proect directory you would see both files.