]> Cypherpunks.ru repositories - gostls13.git/blobdiff - lib/codereview/codereview.py
[dev.garbage] all: merge default (f38460037b72) into dev.garbage
[gostls13.git] / lib / codereview / codereview.py
index 416702c634a895b48f164ff8ef9fabca438b3450..0c9b27a318ea9401bfd175f11abc46fc30da11a5 100644 (file)
@@ -2024,13 +2024,13 @@ def submit(ui, repo, *pats, **opts):
        # push to remote; if it fails for any reason, roll back
        try:
                new_heads = len(hg_heads(ui, repo).split())
-               if old_heads != new_heads and not (old_heads == 0 and new_heads == 1):
+               if cl.desc.find("create new branch") < 0 and old_heads != new_heads and not (old_heads == 0 and new_heads == 1):
                        # Created new head, so we weren't up to date.
                        need_sync()
 
                # Push changes to remote.  If it works, we're committed.  If not, roll back.
                try:
-                       if hg_push(ui, repo):
+                       if hg_push(ui, repo, new_branch=cl.desc.find("create new branch")>=0):
                                raise hg_util.Abort("push error")
                except hg_error.Abort, e:
                        if e.message.find("push creates new heads") >= 0:
@@ -3604,11 +3604,17 @@ class MercurialVCS(VersionControlSystem):
                        if use_hg_shell:
                                base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath], silent_ok=True)
                        else:
-                               base_content = str(self.repo[base_rev][oldrelpath].data())
+                                try:
+                                        base_content = str(self.repo[base_rev][oldrelpath].data())
+                                except Exception:
+                                        pass
                        is_binary = "\0" in base_content  # Mercurial's heuristic
                if status != "R":
-                       new_content = open(relpath, "rb").read()
-                       is_binary = is_binary or "\0" in new_content
+                        try:
+                                new_content = open(relpath, "rb").read()
+                                is_binary = is_binary or "\0" in new_content
+                        except Exception:
+                                pass
                if is_binary and base_content and use_hg_shell:
                        # Fetch again without converting newlines
                        base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath],