2000 files.update(x) |
2000 files.update(x) |
2001 match = scmutil.matchfiles(repo, files) |
2001 match = scmutil.matchfiles(repo, files) |
2002 |
2002 |
2003 bmlist = repo[top].bookmarks() |
2003 bmlist = repo[top].bookmarks() |
2004 |
2004 |
2005 dsguard = None |
2005 with repo.dirstate.parentchange(): |
2006 try: |
2006 # XXX do we actually need the dirstateguard |
2007 dsguard = dirstateguard.dirstateguard(repo, b'mq.refresh') |
2007 dsguard = None |
2008 if diffopts.git or diffopts.upgrade: |
2008 try: |
2009 copies = {} |
2009 dsguard = dirstateguard.dirstateguard(repo, b'mq.refresh') |
2010 for dst in a: |
2010 if diffopts.git or diffopts.upgrade: |
2011 src = repo.dirstate.copied(dst) |
2011 copies = {} |
2012 # during qfold, the source file for copies may |
2012 for dst in a: |
2013 # be removed. Treat this as a simple add. |
2013 src = repo.dirstate.copied(dst) |
2014 if src is not None and src in repo.dirstate: |
2014 # during qfold, the source file for copies may |
2015 copies.setdefault(src, []).append(dst) |
2015 # be removed. Treat this as a simple add. |
2016 repo.dirstate.add(dst) |
2016 if src is not None and src in repo.dirstate: |
2017 # remember the copies between patchparent and qtip |
2017 copies.setdefault(src, []).append(dst) |
2018 for dst in aaa: |
2018 repo.dirstate.add(dst) |
2019 src = ctx[dst].copysource() |
2019 # remember the copies between patchparent and qtip |
2020 if src: |
2020 for dst in aaa: |
2021 copies.setdefault(src, []).extend( |
2021 src = ctx[dst].copysource() |
2022 copies.get(dst, []) |
2022 if src: |
2023 ) |
2023 copies.setdefault(src, []).extend( |
2024 if dst in a: |
2024 copies.get(dst, []) |
2025 copies[src].append(dst) |
2025 ) |
2026 # we can't copy a file created by the patch itself |
2026 if dst in a: |
2027 if dst in copies: |
2027 copies[src].append(dst) |
2028 del copies[dst] |
2028 # we can't copy a file created by the patch itself |
2029 for src, dsts in pycompat.iteritems(copies): |
2029 if dst in copies: |
2030 for dst in dsts: |
2030 del copies[dst] |
2031 repo.dirstate.copy(src, dst) |
2031 for src, dsts in pycompat.iteritems(copies): |
2032 else: |
2032 for dst in dsts: |
2033 for dst in a: |
2033 repo.dirstate.copy(src, dst) |
2034 repo.dirstate.add(dst) |
2034 else: |
2035 # Drop useless copy information |
2035 for dst in a: |
2036 for f in list(repo.dirstate.copies()): |
2036 repo.dirstate.add(dst) |
2037 repo.dirstate.copy(None, f) |
2037 # Drop useless copy information |
2038 for f in r: |
2038 for f in list(repo.dirstate.copies()): |
2039 repo.dirstate.remove(f) |
2039 repo.dirstate.copy(None, f) |
2040 # if the patch excludes a modified file, mark that |
2040 for f in r: |
2041 # file with mtime=0 so status can see it. |
2041 repo.dirstate.remove(f) |
2042 mm = [] |
2042 # if the patch excludes a modified file, mark that |
2043 for i in pycompat.xrange(len(m) - 1, -1, -1): |
2043 # file with mtime=0 so status can see it. |
2044 if not match1(m[i]): |
2044 mm = [] |
2045 mm.append(m[i]) |
2045 for i in pycompat.xrange(len(m) - 1, -1, -1): |
2046 del m[i] |
2046 if not match1(m[i]): |
2047 for f in m: |
2047 mm.append(m[i]) |
2048 repo.dirstate.normal(f) |
2048 del m[i] |
2049 for f in mm: |
2049 for f in m: |
2050 repo.dirstate.normallookup(f) |
2050 repo.dirstate.normal(f) |
2051 for f in forget: |
2051 for f in mm: |
2052 repo.dirstate.drop(f) |
2052 repo.dirstate.normallookup(f) |
2053 |
2053 for f in forget: |
2054 user = ph.user or ctx.user() |
2054 repo.dirstate.drop(f) |
2055 |
2055 |
2056 oldphase = repo[top].phase() |
2056 user = ph.user or ctx.user() |
2057 |
2057 |
2058 # assumes strip can roll itself back if interrupted |
2058 oldphase = repo[top].phase() |
2059 repo.setparents(*cparents) |
2059 |
2060 self.applied.pop() |
2060 # assumes strip can roll itself back if interrupted |
2061 self.applieddirty = True |
2061 repo.setparents(*cparents) |
2062 strip(self.ui, repo, [top], update=False, backup=False) |
2062 self.applied.pop() |
2063 dsguard.close() |
2063 self.applieddirty = True |
2064 finally: |
2064 strip(self.ui, repo, [top], update=False, backup=False) |
2065 release(dsguard) |
2065 dsguard.close() |
|
2066 finally: |
|
2067 release(dsguard) |
2066 |
2068 |
2067 try: |
2069 try: |
2068 # might be nice to attempt to roll back strip after this |
2070 # might be nice to attempt to roll back strip after this |
2069 |
2071 |
2070 defaultmsg = b"[mq]: %s" % patchfn |
2072 defaultmsg = b"[mq]: %s" % patchfn |