Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
agkyra
Commits
9ae2e000
Commit
9ae2e000
authored
Jun 08, 2015
by
Giorgos Korfiatis
Browse files
Use readable timestamp and node name in conflict file
parent
fb628ecc
Changes
2
Hide whitespace changes
Inline
Side-by-side
agkyra/syncer/localfs_client.py
View file @
9ae2e000
...
...
@@ -99,9 +99,28 @@ def file_is_open(path):
return
False
def
is_iso_date
(
tstamp
):
try
:
datetime
.
datetime
.
strptime
(
tstamp
,
"%Y-%m-%dT%H:%M:%S.%f"
)
return
True
except
ValueError
:
return
False
def
get_orig_name
(
filename
):
parts
=
filename
.
split
(
'_'
)
if
len
(
parts
)
<
3
or
parts
[
-
1
]
!=
utils
.
NODE
or
not
is_iso_date
(
parts
[
-
2
]):
return
filename
orig
=
"_"
.
join
(
parts
[:
-
2
])
if
not
orig
:
return
filename
return
orig
def
mk_stash_name
(
filename
):
tstamp
=
datetime
.
datetime
.
now
().
strftime
(
"%s"
)
return
filename
+
'.'
+
tstamp
+
'.local'
tstamp
=
datetime
.
datetime
.
now
().
isoformat
()
orig
=
get_orig_name
(
filename
)
return
orig
+
'_'
+
tstamp
+
'_'
+
utils
.
NODE
def
eq_float
(
f1
,
f2
):
...
...
agkyra/syncer/utils.py
View file @
9ae2e000
...
...
@@ -20,6 +20,7 @@ import threading
import
watchdog.utils
import
sys
import
logging
import
platform
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -27,6 +28,7 @@ from agkyra.syncer.common import OBJECT_DIRSEP
ENCODING
=
sys
.
getfilesystemencoding
()
or
sys
.
getdefaultencoding
()
PLATFORM
=
sys
.
platform
NODE
=
platform
.
node
()
def
to_local_sep
(
filename
):
...
...
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