[PATCH] subrepo: Force updating subrepos if using overwrite option

Saint Germain saintger at gmail.com
Sat Feb 6 15:41:17 UTC 2010


# HG changeset patch
# User Saint Germain <saintger at gmail.com>
# Date 1265470816 -3600
# Node ID aca0fa7b33d0b14969450118456f6a6712835c02
# Parent  b9e44cc97355ff27e05f6cd384061fc12731cec0
subrepo: Force updating subrepos if using overwrite option

Even if .hgsubstate doesn't need updating, subrepos may be 'dirty'. So if using -C (overwrite)
option, add a check for 'dirty' subrepos and if found, force the update.

diff -r b9e44cc97355 -r aca0fa7b33d0 mercurial/merge.py
--- a/mercurial/merge.py	Wed Feb 03 16:09:19 2010 +0000
+++ b/mercurial/merge.py	Sat Feb 06 16:40:16 2010 +0100
@@ -186,6 +186,12 @@
             if n == m2[f] or m2[f] == a: # same or local newer
                 if m1.flags(f) != rflags:
                     act("update permissions", "e", f, rflags)
+                # in case of subrepos, update if overwrite and subrepos is dirty
+                if overwrite and f == '.hgsubstate':
+                    for s in p1.substate:
+                        if p1.sub(s).dirty(): # if dirty, force update
+                            act("remote is newer", "g", f, rflags)
+                            break
             elif n == a: # remote newer
                 act("remote is newer", "g", f, rflags)
             else: # both changed



More information about the Mercurial-devel mailing list