@@ -38,15 +38,13 @@ def RunCmd(cmd):
3838 return stdoutdata .decode ('utf-8' )
3939
4040
41- def CheckRepoIsClean (path , suffix ):
41+ def CheckRepoIsClean (path ):
4242 os .chdir (path ) # As a side effect this also checks for existence of the dir.
4343 # If path isn't a git repo, this will throw and exception.
4444 # And if it is a git repo and 'git status' has anything interesting to say,
4545 # then it's not clean (uncommitted files etc.)
4646 if len (RunCmd (['git' , 'status' , '--porcelain' ])) != 0 :
4747 raise Exception ('%s is not a clean git repo (run git status)' % path )
48- if not path .endswith (suffix ):
49- raise Exception ('%s does not end with /%s' % (path , suffix ))
5048
5149
5250def CheckRepoIsNotAtMainBranch (path ):
@@ -85,6 +83,16 @@ def ReadV8IPRevision(node_src_path):
8583 return line [len (REVISION_LINE_PREFIX ):]
8684 raise Exception ('No V8 inspector protocol revision found' )
8785
86+
87+ def ReadNodeIPRevision (node_src_path ):
88+ lines = open (os .path .join (node_src_path , 'deps/inspector_protocol/README.node' )).readlines ()
89+ for line in lines :
90+ line = line .strip ()
91+ if line .startswith (REVISION_LINE_PREFIX ):
92+ return line [len (REVISION_LINE_PREFIX ):]
93+ raise Exception ('No Node inspector protocol revision found' )
94+
95+
8896def CheckoutRevision (path , revision ):
8997 os .chdir (path )
9098 return RunCmd (['git' , 'checkout' , revision ])
@@ -114,8 +122,8 @@ def main(argv):
114122 upstream = os .path .normpath (os .path .expanduser (args .ip_src_upstream ))
115123 downstream = os .path .normpath (os .path .expanduser (
116124 args .node_src_downstream ))
117- CheckRepoIsClean (upstream , '/src' )
118- CheckRepoIsClean (downstream , '/node' )
125+ CheckRepoIsClean (upstream )
126+ CheckRepoIsClean (downstream )
119127 CheckRepoIsInspectorProtocolCheckout (upstream )
120128 # Check that the destination Git repo isn't at the main branch - it's
121129 # generally a bad idea to check into the main branch, so we catch this
@@ -124,6 +132,10 @@ def main(argv):
124132
125133 # Read V8's inspector_protocol revision
126134 v8_ip_revision = ReadV8IPRevision (downstream )
135+ node_ip_revision = ReadNodeIPRevision (downstream )
136+ if v8_ip_revision == node_ip_revision :
137+ print ('Node is already at V8\' s inspector_protocol revision %s - nothing to do.' % v8_ip_revision )
138+ sys .exit (0 )
127139 print ('Checking out %s into %s ...' % (upstream , v8_ip_revision ))
128140 CheckoutRevision (upstream , v8_ip_revision )
129141
0 commit comments