diff

PHP's DateTime::Diff gets it wrong?

怎甘沉沦 提交于 2019-11-29 03:51:37
DateTime::Diff should calculate a proper interval and take into account Daylight Savings Time (DST) and leap years. Although apparently it isn't so. Code of horror: $d1 = new DateTime("2011-10-30 01:05:00", new DateTimeZone("Europe/Stockholm")); $d2 = new DateTime("2011-10-30 03:05:00", new DateTimeZone("Europe/Stockholm")); echo $d1->getOffset() / (60 * 60); Prints '2'! Keep in mind thus that UTC time = 1h - 2h = 23:05:00 the day before. echo $d2->getOffset() / (60 * 60); Prints '1'. DST happened. UTC time = 3h - 1h = 02:05:00. $di = $d1->diff($d2); echo "Hours of DateInterval: " . $di->h;

Subversion: How to find the differences between two tags?

我的梦境 提交于 2019-11-29 03:41:30
问题 I know that a diff between two tags lists the 'files' which have been changed between those two tags by the following method. svn diff tag1 tag2 |grep Index: Is there any property in Subversion or some technique to find out revision numbers which caused those files to change (i.e differences between tag1 version of the file and tag2 version of the same file)? Thx Vandana 回答1: You can first find the revisions of the tags: svn info http://svn.twig-project.org/tags/RELEASE_0_9_7 | grep 'Last

python dict update diff

蓝咒 提交于 2019-11-29 03:40:59
问题 Does python have any sort of built in functionality of notifying what dictionary elements changed upon dict update? For example I am looking for some functionality like this: >>> a = {'a':'hamburger', 'b':'fries', 'c':'coke'} >>> b = {'b':'fries', 'c':'pepsi', 'd':'ice cream'} >>> a.diff(b) {'c':'pepsi', 'd':'ice cream'} >>> a.update(b) >>> a {'a':'hamburger', 'b':'fries', 'c':'pepsi', 'd':'ice cream'} I am looking to get a dictionary of the changed values as shown in the result of a.diff(b)

How to perform case insensitive diff in Git

♀尐吖头ヾ 提交于 2019-11-29 03:02:14
git diff does not support a case-insensitive comparison of files. Google shows a very few people asking for that feature, and that too only in combination with some other git diff switch, like with -G or with --color-words . I don't care for other switches, as long as git diff can show me the case-insensitive diff. Since I didn't see any specific question towards that, and since I found a solution after an hour researching this problem, I am adding this question and the answer. The solution is to use git difftool . With the following config command, I can add a custom diff tool called idiff

diff'ing diffs with diff?

天涯浪子 提交于 2019-11-29 02:36:12
问题 I need to know if the two patches are effectively the same. I have an old patch file and new patch file created with the unix diff command. Just diff'ing the patches reports differences due to the timestamp when the patch was created. Is there a way (with diff?) that can reliably tell me if the two patches are effectively the same? 回答1: Use interdiff from patchutils. 回答2: You could apply both patches to copies of the same source file and then use diff normally to check for differences in the

Getting readable diff displays in Mercurial on Unicode files (MS Windows)

北慕城南 提交于 2019-11-29 01:55:21
问题 I'm trying to store some Windows PowerShell scripts in a Mercurial repository. It seems the PowerShell editor likes to save files as UTF-16 Unicode. This means that there are lots of \0 bytes, which is what Mercurial uses to distinguish between "text" and "binary" files. I understand that this makes no difference to how Mercurial stores the data, but it does mean that it displays binary diffs, which are kind of hard to read. Is there a way to tell Mercurial that these really are text files?

Why doesn't `git diff` invoke external diff tool?

﹥>﹥吖頭↗ 提交于 2019-11-29 01:44:14
问题 In my repository, if I type $ git diff some-file or $ git difftool some-file I get the in-terminal diff display. I think this should not happen, because I have set up an external diff tool, as shown by the output of git config -l : $ git config -l user.name=blah blah user.email=blah blah http.sslverify=true diff.external=/home/daniel/bin/git-diff <--This is the important line push.default=simple core.filemode=false core.editor=gedit alias.tree=log --all --graph --decorate=short --color -

Is there a metadata exclusion filter for the SVN DIFF command?

Deadly 提交于 2019-11-29 01:07:51
I use SVN as the source control system, and I wonder how to compare directories while ignoring any metadata differences. Is there a way to tell svn diff to compare only the actual content and ignore any metadata? I mean metadata like SVN properties, etc. that don't affect the file content. Assume file X has an additional property in branch B compared to trunk T. Unfortunately it will show up in 'svn diff T B' even though the actual content of file X is the same. I look for something like this: svn diff https://example.org/tags/v1 https://example.org/tags/v2 -x -ignore-metadata --summarize

git diff shows unicode symbols in angle brackets

点点圈 提交于 2019-11-29 00:57:09
问题 I have a file with unicode symbols (russian text). When I fix some typo I use git diff --color-words=. to see the changes I've done. In case of unicode (cyrillic) symbols I get some mess with angle brackets like so: $ cat p1 привет $ cat p2 Привет $ git diff --color-words=. --no-index p1 p2 diff --git 1/p1 2/p2 index d0f56e1..d84c480 100644 --- 1/p1 +++ 2/p2 @@ -1 +1 @@ <D0><BF><9F>ривет It looks like git diff --color-words=. is checking the difference between bytes and not between symbols as

Generating and applying diffs in python

泪湿孤枕 提交于 2019-11-29 00:33:32
问题 Is there an 'out-of-the-box' way in python to generate a list of differences between two texts, and then applying this diff to one file to obtain the other, later? I want to keep the revision history of a text, but I don't want to save the entire text for each revision if there is just a single edited line. I looked at difflib, but I couldn't see how to generate a list of just the edited lines that can still be used to modify one text to obtain the other. 回答1: Did you have a look at diff