Changeset 73384 in webkit


Ignore:
Timestamp:
Dec 6, 2010 12:00:21 PM (13 years ago)
Author:
ojan@chromium.org
Message:

2010-12-02 Ojan Vafai <ojan@chromium.org>

Reviewed by Eric Seidel.

make webkit-patch command work when the git branch is not synced to the remote svn branch
https://bugs.webkit.org/show_bug.cgi?id=50424

  • Scripts/webkitpy/common/checkout/scm.py:
  • Scripts/webkitpy/common/checkout/scm_unittest.py:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r73378 r73384  
     12010-12-02  Ojan Vafai  <ojan@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        make webkit-patch command work when the git branch is not synced to the remote svn branch
     6        https://bugs.webkit.org/show_bug.cgi?id=50424
     7
     8        * Scripts/webkitpy/common/checkout/scm.py:
     9        * Scripts/webkitpy/common/checkout/scm_unittest.py:
     10
    1112010-12-06  Patrick Gansterer  <paroga@webkit.org>
    212
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/scm.py

    r72575 r73384  
    643643        return self.run(["git", "rm", "-f", path])
    644644
    645     def _assert_synced(self):
    646         if len(run_command(['git', 'rev-list', '--max-count=1', self.remote_branch_ref(), '^HEAD'])):
    647             raise ScriptError(message="Not fully merged/rebased to %s. This branch needs to be synced first." % self.remote_branch_ref())
    648 
    649645    def merge_base(self, git_commit):
    650646        if git_commit:
     
    657653            return git_commit
    658654
    659         self._assert_synced()
    660655        return self.remote_merge_base()
    661656
     
    789784        if not force_squash:
    790785            self._assert_can_squash(working_directory_is_clean)
    791         self._assert_synced()
    792         self.run(['git', 'reset', '--soft', self.remote_branch_ref()])
     786        self.run(['git', 'reset', '--soft', self.remote_merge_base()])
    793787        self.commit_locally_with_message(message)
    794788        return self.push_local_commits_to_server()
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py

    r72575 r73384  
    963963        self.assertTrue(re.search(r'test_file_commit1', svn_log))
    964964
     965    def _local_commit(self, filename, contents, message):
     966        write_into_file_at_path(filename, contents)
     967        run_command(['git', 'add', filename])
     968        self.scm.commit_locally_with_message(message)
     969
    965970    def _one_local_commit(self):
    966         write_into_file_at_path('test_file_commit1', 'more test content')
    967         run_command(['git', 'add', 'test_file_commit1'])
    968         self.scm.commit_locally_with_message("another test commit")
     971        self._local_commit('test_file_commit1', 'more test content', 'another test commit')
    969972
    970973    def _one_local_commit_plus_working_copy_changes(self):
     
    975978    def _two_local_commits(self):
    976979        self._one_local_commit()
    977         write_into_file_at_path('test_file_commit2', 'still more test content')
    978         run_command(['git', 'add', 'test_file_commit2'])
    979         self.scm.commit_locally_with_message("yet another test commit")
     980        self._local_commit('test_file_commit2', 'still more test content', 'yet another test commit')
    980981
    981982    def _three_local_commits(self):
    982         write_into_file_at_path('test_file_commit0', 'more test content')
    983         run_command(['git', 'add', 'test_file_commit0'])
    984         self.scm.commit_locally_with_message("another test commit")
     983        self._local_commit('test_file_commit0', 'more test content', 'another test commit')
    985984        self._two_local_commits()
    986985
     
    10841083        scm = detect_scm_system(self.git_checkout_path)
    10851084        self.assertRaises(AmbiguousCommitError, scm.commit_with_message, "another test commit")
     1085        commit_text = scm.commit_with_message("another test commit", force_squash=True)
     1086
     1087        self.assertEqual(scm.svn_revision_from_commit_text(commit_text), '6')
     1088
     1089        svn_log = run_command(['git', 'svn', 'log', '--limit=1', '--verbose'])
     1090        self.assertFalse(re.search(r'test_file2', svn_log))
     1091        self.assertTrue(re.search(r'test_file_commit2', svn_log))
     1092        self.assertTrue(re.search(r'test_file_commit1', svn_log))
     1093
     1094    def test_commit_with_message_not_synced_with_conflict(self):
     1095        run_command(['git', 'checkout', '-b', 'my-branch', 'trunk~3'])
     1096        self._local_commit('test_file2', 'asdf', 'asdf commit')
     1097
     1098        scm = detect_scm_system(self.git_checkout_path)
     1099        # There's a conflict between trunk and the test_file2 modification.
    10861100        self.assertRaises(ScriptError, scm.commit_with_message, "another test commit", force_squash=True)
    10871101
     
    11591173        self._two_local_commits()
    11601174        scm = detect_scm_system(self.git_checkout_path)
    1161         self.assertRaises(ScriptError, scm.create_patch)
     1175        patch = scm.create_patch()
     1176        self.assertFalse(re.search(r'test_file2', patch))
     1177        self.assertTrue(re.search(r'test_file_commit2', patch))
     1178        self.assertTrue(re.search(r'test_file_commit1', patch))
    11621179
    11631180    def test_create_binary_patch(self):
     
    12271244        self._two_local_commits()
    12281245        scm = detect_scm_system(self.git_checkout_path)
    1229         self.assertRaises(ScriptError, scm.changed_files)
     1246        files = scm.changed_files()
     1247        self.assertFalse('test_file2' in files)
     1248        self.assertTrue('test_file_commit2' in files)
     1249        self.assertTrue('test_file_commit1' in files)
     1250
     1251    def test_changed_files_not_synced(self):
     1252        run_command(['git', 'checkout', '-b', 'my-branch', 'trunk~3'])
     1253        self._two_local_commits()
     1254        scm = detect_scm_system(self.git_checkout_path)
     1255        files = scm.changed_files()
     1256        self.assertFalse('test_file2' in files)
     1257        self.assertTrue('test_file_commit2' in files)
     1258        self.assertTrue('test_file_commit1' in files)
    12301259
    12311260    def test_changed_files(self):
Note: See TracChangeset for help on using the changeset viewer.