Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a2637729
Commit
a2637729
authored
Jun 22, 2012
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #7582: Use ISO timestamp in diff.py
parent
ff493c9c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
Tools/scripts/diff.py
Tools/scripts/diff.py
+12
-4
No files found.
Tools/scripts/diff.py
View file @
a2637729
...
@@ -9,6 +9,12 @@
...
@@ -9,6 +9,12 @@
"""
"""
import
sys
,
os
,
time
,
difflib
,
optparse
import
sys
,
os
,
time
,
difflib
,
optparse
from
datetime
import
datetime
,
timezone
def
file_mtime
(
path
):
t
=
datetime
.
fromtimestamp
(
os
.
stat
(
path
).
st_mtime
,
timezone
.
utc
)
return
t
.
astimezone
().
isoformat
()
def
main
():
def
main
():
...
@@ -30,10 +36,12 @@ def main():
...
@@ -30,10 +36,12 @@ def main():
n
=
options
.
lines
n
=
options
.
lines
fromfile
,
tofile
=
args
fromfile
,
tofile
=
args
fromdate
=
time
.
ctime
(
os
.
stat
(
fromfile
).
st_mtime
)
fromdate
=
file_mtime
(
fromfile
)
todate
=
time
.
ctime
(
os
.
stat
(
tofile
).
st_mtime
)
todate
=
file_mtime
(
tofile
)
fromlines
=
open
(
fromfile
,
'U'
).
readlines
()
with
open
(
fromfile
,
'U'
)
as
ff
:
tolines
=
open
(
tofile
,
'U'
).
readlines
()
fromlines
=
ff
.
readlines
()
with
open
(
tofile
,
'U'
)
as
tf
:
tolines
=
tf
.
readlines
()
if
options
.
u
:
if
options
.
u
:
diff
=
difflib
.
unified_diff
(
fromlines
,
tolines
,
fromfile
,
tofile
,
fromdate
,
todate
,
n
=
n
)
diff
=
difflib
.
unified_diff
(
fromlines
,
tolines
,
fromfile
,
tofile
,
fromdate
,
todate
,
n
=
n
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment