mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 07:11:10 +00:00
refactoring
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
author: deadc0de6 (https://github.com/deadc0de6)
|
author: deadc0de6 (https://github.com/deadc0de6)
|
||||||
Copyright (c) 2017, deadc0de6
|
Copyright (c) 2017, deadc0de6
|
||||||
|
|
||||||
handle the comparison of dotfiles and local deployment
|
handle the comparison of two dotfiles
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -17,7 +17,7 @@ class Comparator:
|
|||||||
|
|
||||||
def __init__(self, diffopts='', debug=False):
|
def __init__(self, diffopts='', debug=False):
|
||||||
"""constructor
|
"""constructor
|
||||||
@diffopts: cli switches to pass to unix diff
|
@diffopts: switches to pass to unix diff
|
||||||
@debug: enable debug
|
@debug: enable debug
|
||||||
"""
|
"""
|
||||||
self.diffopts = diffopts
|
self.diffopts = diffopts
|
||||||
@@ -61,12 +61,14 @@ class Comparator:
|
|||||||
self.log.dbg('compare {} and {}'.format(left, right))
|
self.log.dbg('compare {} and {}'.format(left, right))
|
||||||
ret = []
|
ret = []
|
||||||
comp = filecmp.dircmp(left, right)
|
comp = filecmp.dircmp(left, right)
|
||||||
|
|
||||||
# handle files only in deployed file
|
# handle files only in deployed file
|
||||||
for i in comp.left_only:
|
for i in comp.left_only:
|
||||||
if utils.must_ignore([os.path.join(left, i)],
|
if utils.must_ignore([os.path.join(left, i)],
|
||||||
ignore, debug=self.debug):
|
ignore, debug=self.debug):
|
||||||
continue
|
continue
|
||||||
ret.append('=> \"{}\" does not exist on local\n'.format(i))
|
ret.append('=> \"{}\" does not exist on local\n'.format(i))
|
||||||
|
|
||||||
# handle files only in dotpath file
|
# handle files only in dotpath file
|
||||||
for i in comp.right_only:
|
for i in comp.right_only:
|
||||||
if utils.must_ignore([os.path.join(right, i)],
|
if utils.must_ignore([os.path.join(right, i)],
|
||||||
|
|||||||
Reference in New Issue
Block a user