remote-bzr: fix bad state issue
Carried from remote-hg. The problem reportedly happened after doing a push that fails, the abort causes the state of remote-hg to go bad, this happens because remote-hg's marks are not stored, but 'git fast-export' marks are. Ensure that the marks are _always_ stored. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		 Felipe Contreras
					Felipe Contreras
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							23df5e40f0
						
					
				
				
					commit
					d6bb9136c9
				
			| @ -32,6 +32,7 @@ import os | |||||||
| import json | import json | ||||||
| import re | import re | ||||||
| import StringIO | import StringIO | ||||||
|  | import atexit | ||||||
|  |  | ||||||
| NAME_RE = re.compile('^([^<>]+)') | NAME_RE = re.compile('^([^<>]+)') | ||||||
| AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$') | AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$') | ||||||
| @ -728,6 +729,7 @@ def main(args): | |||||||
|     blob_marks = {} |     blob_marks = {} | ||||||
|     parsed_refs = {} |     parsed_refs = {} | ||||||
|     files_cache = {} |     files_cache = {} | ||||||
|  |     marks = None | ||||||
|  |  | ||||||
|     gitdir = os.environ['GIT_DIR'] |     gitdir = os.environ['GIT_DIR'] | ||||||
|     dirname = os.path.join(gitdir, 'bzr', alias) |     dirname = os.path.join(gitdir, 'bzr', alias) | ||||||
| @ -754,6 +756,10 @@ def main(args): | |||||||
|             die('unhandled command: %s' % line) |             die('unhandled command: %s' % line) | ||||||
|         sys.stdout.flush() |         sys.stdout.flush() | ||||||
|  |  | ||||||
|  | def bye(): | ||||||
|  |     if not marks: | ||||||
|  |         return | ||||||
|     marks.store() |     marks.store() | ||||||
|  |  | ||||||
|  | atexit.register(bye) | ||||||
| sys.exit(main(sys.argv)) | sys.exit(main(sys.argv)) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user