5) Duplicates in the list of Deletes and News
6) Close matching diffs even though name changes across directories. (for matching extension)
7) Clearing empty directories after Moves or diffs under Rename.
- 8) Supporting Verbatim - Any entry under Verbatim_list.txt will be treated as NEW files instead of patch.
Current Case
1. Given two folders, from list of REMOVED and NEW files find if there
global COMMON_BIN_PATH
global MEM_REQ
global EMPTY
- global VERBATIM_LIST
global MEM_FILE
DELTA_FS = "DELTA_FS"
EXTRA = "EXTRA"
LOGFILE = "Delta.log"
-VERBATIM_LIST = "Verbatim_List.txt"
EMPTY = ""
MEM_REQ = 0
MEM_FILE = "NULL"
SUPPORT_RENAME = "TRUE" # Use appropriate name
SUPPORT_CONTAINERS = "FALSE"
-SUPPORT_VERBATIM = "TRUE"
TEST_MODE = "FALSE"
files_removed.append(elt)
files_new.append(elt)
- # HANDLING VERBATIM - Remove from changed list and delete the entries on device first
- # This script is called partition wise, So, how do u want to handle it? (specialy for delete case?)
-
- print("Check for any verbatim under - %s" % VERBATIM_LIST)
- if SUPPORT_VERBATIM == "TRUE" and os.path.exists(VERBATIM_LIST):
- with open(VERBATIM_LIST, 'r') as F_News:
- lines = set(F_News.read().splitlines())
- for line in lines:
- if line in files_changed:
- files_changed.remove(line)
- files_removed.append(line)
- if line in files_new:
- files_new.remove(line)
-
# Currently if Version or number is the first character of the file, then we are NOT making any diffs.
if SUPPORT_RENAME == "TRUE":
for elt in files_removed:
New_Cnt = 0
Diff_Cnt = 0
Move_Cnt = 0
- Verbatim_Cnt = 0
SymLinkDoc = OUT_DIR + '/' + PART_NAME + SYMLINK_DOC_NAME
HardLinkDoc = OUT_DIR + '/' + PART_NAME + HARDLINK_DOC_NAME
Partition_Doc = open(OUT_DIR + '/' + PART_NAME + '.txt', 'w')
SS_UpdateSize(src_file, dst_file)
Update_Attr(elt[0], "FILE", File_Attributes, Sym_Attributes)
- # HANDLING VERBATIM - We Process NEWs and DELETEs for Verbatim list ONLY after processing duplicates & rename functionality.
- # So that, the rename functionality will NOT create PATCH instead of verbatims.
-
- if SUPPORT_VERBATIM == "TRUE" and os.path.exists(VERBATIM_LIST):
- with open(VERBATIM_LIST, 'r') as F_News:
- lines = set(F_News.read().splitlines())
- for line in lines:
- if line not in files_new:
- if os.path.exists(BASE_NEW + '/' + line):
- files_new.append(line)
- Verbatim_Cnt = Verbatim_Cnt + 1
- logging.debug("Added to list of verbatims -%s" % BASE_NEW + '/' + line)
-
for elt in files_removed:
# if files are part of patches after renaming, we shd remove them as part of removed.
src_file = BASE_OLD + '/' + elt
logging.info('%d files NEW' % len(files_new))
logging.info('%d File attr' % len(File_Attributes))
logging.info('%d Sym attr' % len(Sym_Attributes))
- logging.info('PaTcHCoUnT:Diffs-%d Moves-%d News-%d Delets-%d SymDiffs-%d SymNews-%d HardDiffs-%d HardNews-%d Verbatim -%d\n' % \
- (Diff_Cnt, Move_Cnt, New_Cnt, Del_Cnt, Sym_Diff_Cnt, Sym_New_Cnt, Hard_Diff_Cnt, Hard_New_Cnt, Verbatim_Cnt))
- print('PaTcHCoUnT:Diffs-%d Moves-%d News-%d Delets-%d SymDiffs-%d SymNews-%d HardDiffs-%d HardNews-%d Verbatim -%d\n' % \
- (Diff_Cnt, Move_Cnt, New_Cnt, Del_Cnt, Sym_Diff_Cnt, Sym_New_Cnt, Hard_Diff_Cnt, Hard_New_Cnt, Verbatim_Cnt))
+ logging.info('PaTcHCoUnT:Diffs-%d Moves-%d News-%d Delets-%d SymDiffs-%d SymNews-%d HardDiffs-%d HardNews-%d\n' % \
+ (Diff_Cnt, Move_Cnt, New_Cnt, Del_Cnt, Sym_Diff_Cnt, Sym_New_Cnt, Hard_Diff_Cnt, Hard_New_Cnt))
+ print('PaTcHCoUnT:Diffs-%d Moves-%d News-%d Delets-%d SymDiffs-%d SymNews-%d HardDiffs-%d HardNews-%d\n' % \
+ (Diff_Cnt, Move_Cnt, New_Cnt, Del_Cnt, Sym_Diff_Cnt, Sym_New_Cnt, Hard_Diff_Cnt, Hard_New_Cnt))
# There could be duplicates, TODO, can check before adding..
ATTR_FILE_D = open(ATTR_FILE, 'a+')
os.remove(SymLinkDoc)
os.remove(HardLinkDoc)
- if Diff_Cnt + Move_Cnt + New_Cnt + Del_Cnt + Sym_Diff_Cnt + Sym_New_Cnt + Verbatim_Cnt + Hard_Diff_Cnt + \
+ if Diff_Cnt + Move_Cnt + New_Cnt + Del_Cnt + Sym_Diff_Cnt + Sym_New_Cnt + Hard_Diff_Cnt + \
Hard_New_Cnt + os.path.getsize(ATTR_FILE) == 0:
print('No Delta Generated for %s - %s' % (PART_NAME, OUT_DIR))
logging.info('No Delta Generated for %s' % PART_NAME)