953 return subset |
959 return subset |
954 except (ValueError, IndexError): |
960 except (ValueError, IndexError): |
955 # Perhaps someone had chosen the same key name (e.g. "added") and |
961 # Perhaps someone had chosen the same key name (e.g. "added") and |
956 # used different syntax for the value. |
962 # used different syntax for the value. |
957 return None |
963 return None |
|
964 |
|
965 |
|
966 def _getsidedata(srcrepo, rev): |
|
967 ctx = srcrepo[rev] |
|
968 filescopies = computechangesetcopies(ctx) |
|
969 filesadded = computechangesetfilesadded(ctx) |
|
970 filesremoved = computechangesetfilesremoved(ctx) |
|
971 sidedata = {} |
|
972 if any([filescopies, filesadded, filesremoved]): |
|
973 sortedfiles = sorted(ctx.files()) |
|
974 p1copies, p2copies = filescopies |
|
975 p1copies = encodecopies(sortedfiles, p1copies) |
|
976 p2copies = encodecopies(sortedfiles, p2copies) |
|
977 filesadded = encodefileindices(sortedfiles, filesadded) |
|
978 filesremoved = encodefileindices(sortedfiles, filesremoved) |
|
979 sidedata[sidedatamod.SD_P1COPIES] = p1copies |
|
980 sidedata[sidedatamod.SD_P2COPIES] = p2copies |
|
981 sidedata[sidedatamod.SD_FILESADDED] = filesadded |
|
982 sidedata[sidedatamod.SD_FILESREMOVED] = filesremoved |
|
983 return sidedata |
|
984 |
|
985 |
|
986 def getsidedataadder(srcrepo, destrepo): |
|
987 def sidedatacompanion(revlog, rev): |
|
988 sidedata = {} |
|
989 if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog |
|
990 sidedata = _getsidedata(srcrepo, rev) |
|
991 return False, (), sidedata |
|
992 |
|
993 return sidedatacompanion |
|
994 |
|
995 |
|
996 def getsidedataremover(srcrepo, destrepo): |
|
997 def sidedatacompanion(revlog, rev): |
|
998 f = () |
|
999 if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog |
|
1000 if revlog.flags(rev) & REVIDX_SIDEDATA: |
|
1001 f = ( |
|
1002 sidedatamod.SD_P1COPIES, |
|
1003 sidedatamod.SD_P2COPIES, |
|
1004 sidedatamod.SD_FILESADDED, |
|
1005 sidedatamod.SD_FILESREMOVED, |
|
1006 ) |
|
1007 return False, f, {} |
|
1008 |
|
1009 return sidedatacompanion |