コード例 #1
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
    def test_conflicts_switch(self):
        gl.switch('other')
        utils.write_file(self.OTHER_FILE, contents='uncommitted')
        gl.switch('master')
        try:
            gl.fuse(self.OTHER, e=self.commits[self.OTHER][0])
            self.fail()
        except ErrorReturnCode:
            pass

        # Switch
        gl.switch('other')
        self.__assert_history(self.__build('other'))
        st_out = utils.stdout(gl.status())
        self.assertTrue('fuse' not in st_out)
        self.assertTrue('conflict' not in st_out)

        gl.switch('master')
        st_out = utils.stdout(gl.status())
        self.assertTrue('fuse' in st_out)
        self.assertTrue('conflict' in st_out)

        # Check that we are able to complete the fuse after switch
        gl.resolve(self.OTHER_FILE)
        gl.commit(m='ci 1 in other')
        self.__assert_history(
            self.__build(self.OTHER, range(1, self.COMMITS_NUMBER)) +
            self.__build('master'))

        gl.switch('other')
        self.assertEqual('uncommitted', utils.read_file(self.OTHER_FILE))
コード例 #2
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
  def test_conflicts_switch(self):
    gl.switch('other')
    utils.write_file(self.OTHER_FILE, contents='uncommitted')
    gl.switch('master')
    try:
      gl.fuse(self.OTHER, e=self.commits[self.OTHER][0])
      self.fail()
    except ErrorReturnCode:
      pass

    # Switch
    gl.switch('other')
    self.__assert_history(self.__build('other'))
    st_out = utils.stdout(gl.status())
    self.assertTrue('fuse' not in st_out)
    self.assertTrue('conflict' not in st_out)

    gl.switch('master')
    st_out = utils.stdout(gl.status())
    self.assertTrue('fuse' in st_out)
    self.assertTrue('conflict' in st_out)

    # Check that we are able to complete the fuse after switch
    gl.resolve(self.OTHER_FILE)
    gl.commit(m='ci 1 in other')
    self.__assert_history(
        self.__build(self.OTHER, range(1, self.COMMITS_NUMBER)) +
        self.__build('master'))

    gl.switch('other')
    self.assertEqual('uncommitted', utils.read_file(self.OTHER_FILE))
コード例 #3
0
  def test_conflicts(self):
    def trigger_conflicts():
      self.assertRaisesRegexp(
          ErrorReturnCode, 'conflicts', gl.fuse,
          self.OTHER, e=self.commits[self.OTHER][0])

    # Abort
    trigger_conflicts()
    gl.fuse('-a')
    self.__assert_history(self.__build('master'))

    # Fix conflicts
    trigger_conflicts()
    gl.resolve(self.OTHER_FILE)
    gl.commit(m='ci 1 in other')
    self.__assert_history(
        self.__build(self.OTHER, range(1, self.COMMITS_NUMBER)) +
        self.__build('master'))
コード例 #4
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
  def test_conflicts(self):
    def trigger_conflicts():
      self.assertRaisesRegexp(
          ErrorReturnCode, 'conflicts', gl.fuse,
          self.OTHER, e=self.commits[self.OTHER][0])

    # Abort
    trigger_conflicts()
    gl.fuse('-a')
    self.__assert_history(self.__build('master'))

    # Fix conflicts
    trigger_conflicts()
    gl.resolve(self.OTHER_FILE)
    gl.commit(m='ci 1 in other')
    self.__assert_history(
        self.__build(self.OTHER, range(1, self.COMMITS_NUMBER)) +
        self.__build('master'))
コード例 #5
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_exclude_one(self):
     last_ci = self.COMMITS_NUMBER - 1
     gl.fuse(self.OTHER, e=self.commits[self.OTHER][last_ci])
     self.__assert_history(
         self.__build(self.OTHER, range(0, last_ci)) +
         self.__build('master'))
コード例 #6
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_only_some(self):
     gl.fuse(self.OTHER, '-o', self.commits[self.OTHER][:2])
     self.__assert_history(
         self.__build(self.OTHER, [0, 1]) + self.__build('master'))
コード例 #7
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_only_one(self):
     gl.fuse(self.OTHER, o=self.commits[self.OTHER][0])
     self.__assert_history(
         self.__build(self.OTHER, cids=[0]) + self.__build('master'))
コード例 #8
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_basic(self):
     gl.fuse(self.OTHER)
     self.__assert_history(
         self.__build(self.OTHER) + self.__build('master'))
コード例 #9
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_basic(self):
   gl.fuse(self.OTHER)
   self.__assert_history(self.__build(self.OTHER) + self.__build('master'))
コード例 #10
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
    def test_ff_ip_head(self):
        gl.branch(c='tmp', divergent_point='HEAD~2')
        gl.switch('tmp')

        gl.fuse('master', insertion_point='HEAD')
        self.__assert_history(self.__build('master'))
コード例 #11
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_exclude_one(self):
   last_ci = self.COMMITS_NUMBER - 1
   gl.fuse(self.OTHER, e=self.commits[self.OTHER][last_ci])
   self.__assert_history(
       self.__build(self.OTHER, range(0, last_ci)) + self.__build('master'))
コード例 #12
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_ip_head(self):
     gl.fuse(self.OTHER, insertion_point='HEAD')
     self.__assert_history(
         self.__build('master') + self.__build(self.OTHER))
コード例 #13
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_ip_commit(self):
   gl.fuse(self.OTHER, insertion_point=self.commits['master'][1])
   self.__assert_history(
       self.__build('master', [0, 1]) + self.__build(self.OTHER) +
       self.__build('master', range(2, self.COMMITS_NUMBER)))
コード例 #14
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_ip_head(self):
   gl.fuse(self.OTHER, insertion_point='HEAD')
   self.__assert_history(self.__build('master') + self.__build(self.OTHER))
コード例 #15
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_ip_dp(self):
   gl.fuse(self.OTHER, insertion_point='dp')
   self.__assert_history(self.__build(self.OTHER) + self.__build('master'))
コード例 #16
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_exclude_some(self):
   gl.fuse(self.OTHER, '-e', self.commits[self.OTHER][1:])
   self.__assert_history(
       self.__build(self.OTHER, cids=[0]) + self.__build('master'))
コード例 #17
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_exclude_some(self):
     gl.fuse(self.OTHER, '-e', self.commits[self.OTHER][1:])
     self.__assert_history(
         self.__build(self.OTHER, cids=[0]) + self.__build('master'))
コード例 #18
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_only_one(self):
   gl.fuse(self.OTHER, o=self.commits[self.OTHER][0])
   self.__assert_history(
       self.__build(self.OTHER, cids=[0]) + self.__build('master'))
コード例 #19
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_ip_dp(self):
     gl.fuse(self.OTHER, insertion_point='dp')
     self.__assert_history(
         self.__build(self.OTHER) + self.__build('master'))
コード例 #20
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_only_some(self):
   gl.fuse(self.OTHER, '-o', self.commits[self.OTHER][:2])
   self.__assert_history(
       self.__build(self.OTHER, [0, 1]) + self.__build('master'))
コード例 #21
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_ip_commit(self):
     gl.fuse(self.OTHER, insertion_point=self.commits['master'][1])
     self.__assert_history(
         self.__build('master', [0, 1]) + self.__build(self.OTHER) +
         self.__build('master', range(2, self.COMMITS_NUMBER)))
コード例 #22
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
  def test_basic_functionality(self):
    utils.write_file('file1', 'Contents of file1')
    # Track
    gl.track('file1')
    self.assertRaises(ErrorReturnCode, gl.track, 'file1')
    self.assertRaises(ErrorReturnCode, gl.track, 'non-existent')
    # Untrack
    gl.untrack('file1')
    self.assertRaises(ErrorReturnCode, gl.untrack, 'file1')
    self.assertRaises(ErrorReturnCode, gl.untrack, 'non-existent')
    # Commit
    gl.track('file1')
    gl.commit(m='file1 commit')
    self.assertRaises(ErrorReturnCode, gl.commit, m='nothing to commit')
    # History
    if 'file1 commit' not in utils.stdout(gl.history(_tty_out=False)):
      self.fail('Commit didn\'t appear in history')
    # Branch
    # Make some changes to file1 and branch out
    utils.write_file('file1', 'New contents of file1')
    gl.branch(c='branch1')
    gl.switch('branch1')
    if 'New' in utils.read_file('file1'):
      self.fail('Branch not independent!')
    # Switch back to master branch, check that contents are the same as before.
    gl.switch('master')
    if 'New' not in utils.read_file('file1'):
      self.fail('Branch not independent!')
    out = utils.stdout(gl.branch(_tty_out=False))
    if '* master' not in out:
      self.fail('Branch status output wrong: {0}'.format(out))
    if 'branch1' not in out:
      self.fail('Branch status output wrong: {0}'.format(out))

    gl.branch(c='branch2')
    gl.branch(c='branch-conflict1')
    gl.branch(c='branch-conflict2')
    gl.commit(m='New contents commit')

    # Fuse
    gl.switch('branch1')
    self.assertRaises(ErrorReturnCode, gl.fuse)  # no upstream set
    try:
      gl.fuse('master')
    except ErrorReturnCode as e:
      self.fail(utils.stderr(e))
    out = utils.stdout(gl.history(_tty_out=False))
    if 'file1 commit' not in out:
      self.fail(out)

    # Merge
    gl.switch('branch2')
    self.assertRaises(ErrorReturnCode, gl.merge)  # no upstream set
    gl.merge('master')
    out = utils.stdout(gl.history(_tty_out=False))
    if 'file1 commit' not in out:
      self.fail(out)

    # Conflicting fuse
    gl.switch('branch-conflict1')
    utils.write_file('file1', 'Conflicting changes to file1')
    gl.commit(m='changes in branch-conflict1')
    err = utils.stderr(gl.fuse('master', _tty_out=False, _ok_code=[1]))
    if 'conflict' not in err:
      self.fail(err)
    out = utils.stdout(gl.status(_tty_out=False))
    if 'file1 (with conflicts)' not in out:
      self.fail(out)

    # Try aborting
    gl.fuse('--abort')
    out = utils.stdout(gl.status(_tty_out=False))
    if 'file1' in out:
      self.fail(out)

    # Ok, now let's fix the conflicts
    err = utils.stderr(gl.fuse('master', _tty_out=False, _ok_code=[1]))
    if 'conflict' not in err:
      self.fail(err)
    out = utils.stdout(gl.status(_tty_out=False))
    if 'file1 (with conflicts)' not in out:
      self.fail(out)

    utils.write_file('file1', 'Fixed conflicts!')
    self.assertRaises(ErrorReturnCode, gl.commit, m='resolve not called')
    self.assertRaises(ErrorReturnCode, gl.resolve, 'non-existent')
    gl.resolve('file1')
    gl.commit(m='fixed conflicts')
コード例 #23
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
    def test_basic_functionality(self):
        utils.write_file('file1', 'Contents of file1')
        # Track
        gl.track('file1')
        self.assertRaises(ErrorReturnCode, gl.track, 'file1')
        self.assertRaises(ErrorReturnCode, gl.track, 'non-existent')
        # Untrack
        gl.untrack('file1')
        self.assertRaises(ErrorReturnCode, gl.untrack, 'file1')
        self.assertRaises(ErrorReturnCode, gl.untrack, 'non-existent')
        # Commit
        gl.track('file1')
        gl.commit(m='file1 commit')
        self.assertRaises(ErrorReturnCode, gl.commit, m='nothing to commit')
        # History
        if 'file1 commit' not in utils.stdout(gl.history()):
            self.fail('Commit didn\'t appear in history')
        # Branch
        # Make some changes to file1 and branch out
        utils.write_file('file1', 'New contents of file1')
        gl.branch(c='branch1')
        gl.switch('branch1')
        if 'New' in utils.read_file('file1'):
            self.fail('Branch not independent!')
        # Switch back to master branch, check that contents are the same as before.
        gl.switch('master')
        if 'New' not in utils.read_file('file1'):
            self.fail('Branch not independent!')
        out = utils.stdout(gl.branch())
        if '* master' not in out:
            self.fail('Branch status output wrong: {0}'.format(out))
        if 'branch1' not in out:
            self.fail('Branch status output wrong: {0}'.format(out))

        gl.branch(c='branch2')
        gl.branch(c='branch-conflict1')
        gl.branch(c='branch-conflict2')
        gl.commit(m='New contents commit')

        # Fuse
        gl.switch('branch1')
        self.assertRaises(ErrorReturnCode, gl.fuse)  # no upstream set
        try:
            gl.fuse('master')
        except ErrorReturnCode as e:
            self.fail(utils.stderr(e))
        out = utils.stdout(gl.history())
        if 'file1 commit' not in out:
            self.fail(out)

        # Merge
        gl.switch('branch2')
        self.assertRaises(ErrorReturnCode, gl.merge)  # no upstream set
        gl.merge('master')
        out = utils.stdout(gl.history())
        if 'file1 commit' not in out:
            self.fail(out)

        # Conflicting fuse
        gl.switch('branch-conflict1')
        utils.write_file('file1', 'Conflicting changes to file1')
        gl.commit(m='changes in branch-conflict1')
        err = utils.stderr(gl.fuse('master', _ok_code=[1]))
        if 'conflict' not in err:
            self.fail(err)
        out = utils.stdout(gl.status())
        if 'file1 (with conflicts)' not in out:
            self.fail(out)

        # Try aborting
        gl.fuse('--abort')
        out = utils.stdout(gl.status())
        if 'file1' in out:
            self.fail(out)

        # Ok, now let's fix the conflicts
        err = utils.stderr(gl.fuse('master', _ok_code=[1]))
        if 'conflict' not in err:
            self.fail(err)
        out = utils.stdout(gl.status())
        if 'file1 (with conflicts)' not in out:
            self.fail(out)

        utils.write_file('file1', 'Fixed conflicts!')
        self.assertRaises(ErrorReturnCode, gl.commit, m='resolve not called')
        self.assertRaises(ErrorReturnCode, gl.resolve, 'non-existent')
        gl.resolve('file1')
        gl.commit(m='fixed conflicts')
コード例 #24
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
  def test_ff_ip_head(self):
    gl.branch(c='tmp', divergent_point='HEAD~2')
    gl.switch('tmp')

    gl.fuse('master', insertion_point='HEAD')
    self.__assert_history(self.__build('master'))
コード例 #25
0
ファイル: test_e2e.py プロジェクト: youngkai1/gitless-1
 def test_uncommitted_changes(self):
     utils.write_file(self.MASTER_FILE, contents='uncommitted')
     utils.write_file('master_untracked', contents='uncommitted')
     gl.fuse(self.OTHER)
     self.assertEqual('uncommitted', utils.read_file(self.MASTER_FILE))
     self.assertEqual('uncommitted', utils.read_file('master_untracked'))
コード例 #26
0
ファイル: test_e2e.py プロジェクト: imoapps/gitless
 def test_uncommitted_changes(self):
   utils.write_file(self.MASTER_FILE, contents='uncommitted')
   utils.write_file('master_untracked', contents='uncommitted')
   gl.fuse(self.OTHER)
   self.assertEqual('uncommitted', utils.read_file(self.MASTER_FILE))
   self.assertEqual('uncommitted', utils.read_file('master_untracked'))